Filling in missing glyphs in fonts with fontforge - unicode

Background
I'm trying to convert the Google Noto Sans JP font from a .otf to a .ttf, using the following fontforge script:
#!/usr/bin/env fontforge
Open($1)
CIDFlatten()
Generate($1:r + ".ttf")
Close()
When I call Open on the .otf, I get a load of errors saying that there are lots of missing glyphs:
No glyph with unicode U+07d22 in font
No glyph with unicode U+07d2f in font
No glyph with unicode U+07da0 in font
...
My script converts the .otf into a .ttf but, sure enough, when I load the font these characters aren't rendered (they look like this: [X]).
So I'd like to fill in the gaps and copy identical glyphs into the missing slots.
The Problem
So I run the following script to try and substitute one of the missing glyphs (U+7d22) with an identical one (U+f96a):
#!/usr/bin/env fontforge
Open($1)
CIDFlatten()
Select(0uf96a)
Copy()
Select(0u7d22)
Paste()
SelectNone()
Generate($1:r + ".ttf")
Close()
However fontforge fails to select the non-existent character U+7d22:
Select: Character not found: U+7D22
Does anyone know how to copy a glyph to a codepoint that doesn't have a glyph?
Or in other words, does anyone know how to fill the gaps in this font?

It turns out you can "fill in the gaps" in ttf format, so I first converted the font, then copied the glyphs, like so:
#!/usr/bin/env fontforge
Open($1)
CIDFlatten()
Generate($1:r + ".ttf")
Close()
Open($1:r + ".ttf")
Select(0uf96a)
Copy()
Select(0u7d22)
Paste()
SelectNone()
Generate($1:r + ".ttf")
Close()

Related

Font whose glyphs all display as missing characters, might be named 'nosuchglyph'

I could use a font that might be named 'nosuchglyph'. This could be used for testing a font on the web with a font stack specified something like
style="font-family:'Some Font Regular', 'nosuchglyph'"
Every glyph would be an appropriate missing-character glyph. It could be minimally the same glyph for every single character -- something like a black rectangle or a rectangle outline with a '?' in the middle, or some similar image to convey that this glyph is missing. More ideal would be a rectangle per Unicode character code with a tiny display of that character code, something like this ASCII art for, say, the character code U+4f4f:
[4f4f]
Whatever it is, for any glyph missing in "Some Font Regular" (in this example) the glyph in the output would come from "nosuchglyph".
This is nice for testing in order to see for a given font, say, "Some Regular Font" as in the example, which characters are from that font and which are missing. This is meant to ensure you do not get the normal substitution for missing characters, which would show the glyph from a font later in the stack or else from some default fallback font.

Font for "math bold script" unicode charset

I wouldn't believe I have been stuck on this for one hour, but it seems the fonts for extended unicode characters are not easyly available as TTF / OTF for use on computers, especially with graphic software where unicode fallback doesn't work
especifically I looking for the so called Math bold script
somehting like : 𝓓𝓮𝓶𝓸 𝓯𝓸𝓷𝓽 𝓐𝓑𝓒𝓖𝓟 𝓮𝓻𝓽𝓷𝓭 (<- those are extended chars)
as in https://textfancy.com/font-converter/
as imagen at: https://snipboard.io/fNYd7w.jpg
(becouse I am not sure we all see the same glyphs)
Note: what I am looking for, is a standrd TTF font, which normal glyphs are equal to those extended glyphs, meaning that the A looks like the 𝓐, B like 𝓑, and so on. So I could use the font as normal font in every software.
The STIX math fonts support the Unicode Mathematical Alphanumeric Symbols block.
https://www.stixfonts.org/
https://github.com/stipub/stixfonts
(Note: the variable fonts don't include support for that block of characters; only the static fonts do.)
Please note the intended use of those Unicode characters, as pointed out in the STIX project:
The sans serif, fraktur, script, etc., alphabets in Plane 1 (U+1D400-U+1D4FF) are intended to be used only as technical symbols.

What is different between encoding and font

Encoding is maping that gives characters or symbols a unique value.
If a character is not present in encoding no matter what font you use it won't display correct fonts
Like Lucida console, arial or terminal
But problem is terminal font is showing line draw characters but other font is not showing line draw characters
My question is why terminal is behaving different to other font
Plz note
Windows 7
Locale English
For the impatient, the relevant link is at the bottom of this answer.
Encoding is maping that gives characters or symbols a unique value.
No, that are the specifics of a character-set, which maps certain characters to code points (using the Unicode terminology). Lets ignore the above for now.
If a character is not present in encoding no matter what font you use it won't display correct fonts Like Lucida console, arial or terminal
Font formats map Unicode code points to glyphs. Not all code points may be mapped for specific fonts - somebody has to create all these symbols. Again, lets ignore this.
Not all binary encodings may map to code points within a certain character set; this is possibly what you mean.
But problem is terminal font is showing line draw characters but other font is not showing line draw characters
Your terminal seems to operate on a different character set, probably the "OEM" or "IBM PC" character set instead of a Unicode compliant character set or Windows-1252 / ISO 8859-1 / Latin.
If it is the latter than you are out of luck unless you can set your output-terminal to another character set, as Windows-1252 doesn't support the box drawing characters at all.
Solutions:
If possible try and set the output to OEM / IBM PC character set.
If it is Unicode you can try and convert the output to Unicode: read it in (decode it) using the OEM character set and then re-encode it using the box drawing subset.

Where to get "all-chars-are-zero-spaces" fallback font?

In order to detect if font contains some particular character in javascript I've decided that the best way is to have fallback font where ALL unicode characters have exactly ZERO width spaces. This font would allow me to easily check existing of himself, and existing of any character in any other font (except for conrtol characters). I would just check width of character.
Do you know if such font already exists?
It should be very simple to make it with FontForge and scripting. But it is hard for me to get into FontForge and Unicode docs. If someone is fluent in FontForge, could you teach me, or just make this kind of font. I assume it is, what, like 50 script lines on Python?
https://github.com/adobe-fonts/adobe-blank – answered by Mike 'Pomax' Kamermans
Very nice. Just 7kb for woff version! My own attempts to make such a font myself in FontForge gave about 1mb for 0000-1ffff unicode range.

Miscellaneous characters in xmgrace

xmgrace is wonderful, but it has some problems when dealing with miscellaneous characters.
How can I make the script small l ($\ell$ in latex) in xmgrace?
I believe the only way to do this is to specify a script-like system font. None of the standard ones are suitable so you will have to make sure that a suitable font is installed on your system.
You can change to any font by enclosing the name in
\f{}
e.g.
\f{Symbol}
or
\f{Century-Schoolbook-L-Bold_italic}
You can see a list of the available fonts (and their labels) by going to the Font tool in the Window menu of the xmgrace GUI.
After typing the special character you can return to your original font in a similar way, or by using \0 to get back to the default font 0.