figuring out whether a given font has Unicode Canadian Aboriginal Syllabics glyphs

Devin Asay devin_asay at byu.edu
Fri Aug 8 12:09:53 EDT 2008


On Aug 7, 2008, at 4:15 PM, Randolph Valentine wrote:

> Hi, all. I have a question regarding how to reliably determine that  
> a font
> is a Unicode font which has Canadian Aboriginal Syllabics (CAS)  
> glyphs. Now
> evidently because I'm working with Canadian Aborginal Syllabics,  
> even when I
> use a clearly Unicode font having these glyphs, and ask for the
> fontlanguage, it gives me ASCI. So I thought would write a script  
> that 1.
> selects a font, 2. sets a field to that font, 3. puts a CAS  
> character e.g.
> chartonum(5169) into the field, and if the font isn't Unicode, then no
> character should show up. My little script (within an option menu that
> provides the user with all of the fonts from fontnames) looks like  
> this:
>
> on menuPick pChosen
>    set the textfont of fld "unicode_tester" to pChosen
>    set the useunicode to true
>    set the unicodetext of fld "unicode_tester" to numtochar(5169)
> end menuPick
>
> The problem is that even when I select a non-unicode font, I am still
> getting the proper Syllabic character showing up for some reason.  
> Anyone
> know why, and what I could do to get this to work? Basically, I want  
> my
> users to be able to tell if a font they pick is a unicode font having
> Canadian Aboriginal Syllabics. Thank you!

Hi Rand,

Unfortunately, Unicode in Rev doesn't give you much control over the  
font the characters are displayed in. When you request a unicode  
character, the OS takes over and finds a suitable font (if any) to  
display it in. You really have little control over it. It is a known  
issue. See <http://quality.runrev.com/qacenter/show_bug.cgi?id=2493>.

There is a possible workaround. Try something like this (not tested,  
but I've used this technique lots):

on menuPick pChosen
    set the useunicode to true
    set the unicodetext of fld "unicode_tester" to numtochar(5169)
    put the textFont of char 1 of fld "unicode_tester" into tFont1
    get the htmlText of fld "unicode_tester"
    replace tFont1 with pChosen in it
    set the htmlText of fld "unicode_tester" to it
end menuPick

If you examine the htmlText of a field with unicode text in it, you'll  
see the <font> tags with face= elements that define the font for  
unicode characters. The characters themselves are HTML unicode  
entities. I've had good success changing fonts by just replacing the  
face= element in font tags like this.

Another thing that might work is:

    set the useunicode to true
    set the unicodetext of fld "unicode_tester" to numtochar(5169)
    put the textFont of char 1 of fld "unicode_tester" into tFont1
    replace item 1 of tFont1 with pChosen
    set the unicodeText of char 1 of fld "unicode_tester" to tFont1

I'll be interested in hearing if this works for you.

Regards,

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list