How to change glyph layer color from black to Foreground in color font
Muhammad Zeeshan Nasar
Posts: 6
Hy!
I am working on a color font in which each glyph is consist of multiple layers, Actually it is an Arabic Quran font, I am applying intonation (Tajweed) rules by coloring different parts of glyphs in different layers. Almost I had completed the font but unfortunately I had applied all glyph base color as black instead of foreground color (based on user choice) Now I want to change black color into foreground color. (so that the user can change the base color of his choice but the colored part remains same, it will also be helpful in using the font in night mode) I had tried it to do manually one by one each glyph, but it takes a lot of time because there are almost 150000 glyphs in my font. so I want to find out a way how can I set this in a single command. I want automation to complete my job in time. is there is any scripts that will solve my problem? I am using Font Creator 13 software and using CPAL and COLR tbales.
Please guide me. Thanks alot..
I am working on a color font in which each glyph is consist of multiple layers, Actually it is an Arabic Quran font, I am applying intonation (Tajweed) rules by coloring different parts of glyphs in different layers. Almost I had completed the font but unfortunately I had applied all glyph base color as black instead of foreground color (based on user choice) Now I want to change black color into foreground color. (so that the user can change the base color of his choice but the colored part remains same, it will also be helpful in using the font in night mode) I had tried it to do manually one by one each glyph, but it takes a lot of time because there are almost 150000 glyphs in my font. so I want to find out a way how can I set this in a single command. I want automation to complete my job in time. is there is any scripts that will solve my problem? I am using Font Creator 13 software and using CPAL and COLR tbales.
Please guide me. Thanks alot..
Tagged:
0
Comments
-
waiting for expert opinion0
-
In the font's CPAL table, the value 0xFFFF is used to indicate the app-determined foreground colour. @Erwin Denissen would be able to tell how to set that in Font Creator.0
-
As far as I know, Font Creator operates directly on the TrueType font and doesn't use a dedicated font source format. So you could operate directly on the font file with some other tools. The easiest would probably be the Python FontTools with a small Python script like this:
from fontTools.ttLib import TTFont COLOR_INDEX_TO_MODIFY = 11 f = TTFont("TwemojiMozilla.ttf") colr = f["COLR"] for name, layers in colr.ColorLayers.items(): print(f"Color glyph: {name}") for layer in layers: print(f" Layer glyph: {layer.name} with color ID {layer.colorID}") if layer.colorID == COLOR_INDEX_TO_MODIFY: layer.colorID = 0xffff # The special index that maps to the foreground color print(" ... modified") f.save("TwemojiMozilla_modified.ttf")
If you have a font with 150000 glyphs, you probably want to remove the print statements0 -
>If you have a font with 150000 glyphs
Well, wouldn't that be cool! OpenType 2.0!0 -
Ha, I didn't even notice that the number is impossible0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 803 Font Technology
- 1K Technique and Theory
- 622 Type Business
- 444 Type Design Critiques
- 542 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 485 Typography
- 303 History of Typography
- 114 Education
- 68 Resources
- 499 Announcements
- 80 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 270 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports