Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FontForge: Count of Defined Glyphs

I'm fairly new to FontForge, and I just want to merge two fonts for my specific usage.

I know how to merge two fonts from this question and I'm aware of TTF, ... 65535 lookup limits, so I'm trying to Detach & Remove Glyphs... for some glyph ranges, and for this:

I need to know how many glyph is defined, so I can decide which range to detach and remove. It seems fairly simple info, but I can not find where it is shown. is there any menu or macro to show the current number of defined glyphs in FontForge?

like image 291
2i3r Avatar asked Oct 24 '25 22:10

2i3r


2 Answers

I think found an answer, however it may not be the best approach. as FontForge saves projects in plain text, we can search for StartChar: keywords in the saved project file (project_name.sfd), which each section started by a StartChar: defines one glyphs in the font project. so if we count them we may know how many glyphs has been defined in the font file, for example, in bash the command:

grep -E "^StartChar\:" project_name.sfd | wc -l

would count them for us, and then we may know how many glyphs has been define so far.

like image 53
2i3r Avatar answered Oct 27 '25 23:10

2i3r


I was looking for the same info. This will give you the number of defined glyphs fairly quickly:

fontforge -lang=ff \
   -c 'Open($1); SelectWorthOutputting(); Print($selection)' "$FONTFILE" \
   2>/dev/null |tr -d '][' |tr , '\n' |grep -c 1

The SelectWorthOutputting() function fills an array with ones for each defined glyph, so we can print this out and filter it to get the count.

like image 27
Jerry Penner Avatar answered Oct 27 '25 21:10

Jerry Penner