LiveCode's handling of Unicode glyphs being dependent on the underlying OS

Mark Waddingham mark at livecode.com
Tue Mar 28 03:51:33 EDT 2017


On 2017-03-27 14:39, Mark Waddingham via use-livecode wrote:
> In regards to your specific requirements, I had a thought on that last
> night. I think essentially what you want is a way to treat a sequence
> of codepoints in a field as a sequence of glyph indicies into the
> current font. So rather than treating the 0x1CF7 codepoint as a
> character, it would just be treated as a number to index into the
> glyph table of the (inherited) font set on its style. This could be
> done as a textStyle, although that would give you no control over
> positioning, the only thing it could do there is use the advance width
> / baseline in the glyph to position it sequentially.

I realized that you don't actually need this at all - the PUA can be 
used to do precisely this.

As I'm sure you realize, a font has a 'cmap' table which maps codepoints 
to glyphs and this is can be a many->one mapping - i.e. you can have 
more than one codepoint mapping to the same glyph. So what you could do 
is:

   1) Map all the unicode defined codepoints to their appropriate glyphs 
(noting that use of these codepoints will cause the standard rules to be 
applied when typesetting strings).

   2) Map all the glyphs you want access to a block in the PUA (noting 
that these codepoints will have no extra processing)

You can then use PUA codepoints to get 'just the glyphs', or the normal 
codepoints if you want the standard behavior.

In the future you could look into adding OpenType tables (GPOS, GDEF and 
GSUB in particular) to your font - these allow the font to define things 
like complex kerning, ligatures (where two characters combine into one 
glyph), accents (where single character is composed of a base glyph and 
an accent attached to it) and all kinds of other things without the 
software using it having to know anything about the gory details.

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list