Unicode Code Page


#1

Is there anyway in Juce to determine the code page a font is using for it's characters? I hope I am asking this correctly.

For example I want to choose a Unicode font and display all of its characters using unicode numbers.


#2

I'm not an expert on font file formats, but I don't think they have a "code page".. My understanding is that they just contain whatever set of glyphs they choose to. There could be some kind of property that they publish which gives a hint about the range of glyphs they cover but if so it's not something that juce exposes.


#3

That is what I thought. I use Font Creator and they show you the glyphs and what code point is associated with the glyph index.

Is there a way to determine the character code for a given glyph index? Could you expose the number of glyphs in the font. I peeked around in your code and saw hints of this. 

I'll also look into this a bit more. I need this because the music fonts in the future are unicode and most of them are storeing the characters in the user area. A prime example in Bravura by Steinberg with over 2400 characters.


#4

It's not quite as simple as there being a 1:1 mapping between characters and glyphs, and unfortunately some (actually most) font APIs don't provide access to the list of glyphs, they try to hide this by e.g. returning a glyph from a fall-back font if the one you ask for isn't found.


#5

OK, so how do you suppose Font Editors do this? They provide a list of the glyphs and then the unicode number (code point) for each glyph.

I can work around most of this by having a table for each unicode music font I see, but what a pain.


#6

Font editors will look inside the font and access its tables directly. Obviously they have code that can manipulate the font file format, they don't need to go via the OS APIs.


#7

That is the way I am headed.