Skip to content

Conversation

@Lynnesbian
Copy link
Contributor

Adds the Material Symbols icon suite. Closes #3.

There are two issues I'd like to bring to your attention before you merge this PR:


Firstly, some of the Material Symbols have names starting with digits, such as 10mp-symbolic.svg. These can't be used as constants, so I updated the codegen file to produce names like ICON_10MP if the icon's name starts with a digit. This is a bit of a hack, so if you'd like me to approach this issue in some other way, I'd be happy to do so.


The second issue is much more complicated.

I ran into a really confusing bug while adding these icons, and I've worked around it in a somewhat hacky way. Current versions of the Material Symbols icon set seemingly use an SVG feature that the GTK renderer can't cope with. To work around this, I've checked out the material-symbols submodule at a commit version that predates this change.

For example, the file 10mp.svg currently looks like this:

<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M336-510h50v-240H273v50h63v190Zm190 0h90q14 0 27-13t13-27v-160q0-14-13-27t-27-13h-90q-14 0-27 13t-13 27v160q0 14 13 27t27 13Zm10-50v-140h70v140h-70ZM233-210h50v-190h53v127h50v-127h60v190h50v-200q0-14-13-27t-27-13H273q-14 0-27 13t-13 27v200Zm323 0h50v-63h80q14 0 27-13t13-27v-97q0-14-13-27t-27-13H556v240Zm50-113v-77h70v77h-70ZM180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm0-60h600v-600H180v600Zm0-600v600-600Z"/></svg>

This version of the icon doesn't render for me on Fedora Workstation 43 (KDE) with GTK 4.20.3. Instead, there's a blank square where the icon should be.

The version I've checked the submodule out to looks like this:

<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M16.8 22.5h2.5v-12h-5.65V13h3.15Zm9.5 0h4.5q.7 0 1.35-.65.65-.65.65-1.35v-8q0-.7-.65-1.35-.65-.65-1.35-.65h-4.5q-.7 0-1.35.65-.65.65-.65 1.35v8q0 .7.65 1.35.65.65 1.35.65Zm.5-2.5v-7h3.5v7ZM11.65 37.5h2.5V28h2.65v6.35h2.5V28h3v9.5h2.5v-10q0-.7-.65-1.35-.65-.65-1.35-.65h-9.15q-.7 0-1.35.65-.65.65-.65 1.35Zm16.15 0h2.5v-3.15h4q.7 0 1.35-.65.65-.65.65-1.35V27.5q0-.7-.65-1.35-.65-.65-1.35-.65h-6.5Zm2.5-5.65V28h3.5v3.85ZM9 42q-1.2 0-2.1-.9Q6 40.2 6 39V9q0-1.2.9-2.1Q7.8 6 9 6h30q1.2 0 2.1.9.9.9.9 2.1v30q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h30V9H9v30ZM9 9v30V9Z"/></svg>

This icon renders fine.

I really don't know what causes this -- it could be the viewBox, the change in path format, or something else entirely.

Even more strangely, the issue only shows up when I include the icon through relm4-icons. If I bundle the icon myself, using a gresource.xml file like this...

<?xml version="1.0" encoding="UTF-8" ?>
<gresources>
	<gresource prefix="/space/lynnesbian/langvil/icons">
		<file preprocess="xml-stripblanks" alias="test.svg">/path/to/relm4-icons/build_icons/icons/material-symbols/10mp-symbolic.svg</file>
	</gresource>
</gresources>

...it works! The exact same 10mp-symbolic.svg file works if included directly in this manner, but doesn't render if included by relm4-icons. 😵‍💫

closes Relm4#3.

the material-symbols submodule is set to point to commit
ea15af63efe0d712a7312a3a47d1a31d031d0dc5. later commits changed the
SVG format in a way that is seemingly incompatible with
GTK -- using the latest revision will result in the icons being
included, but not rendering.
"over 3000 icons" is true, but sells it short!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add Material Icons to the mix

1 participant