freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Freetype] How do I tell if a font supports a given Unicode set of


From: David Turner
Subject: Re: [Freetype] How do I tell if a font supports a given Unicode set of characters?
Date: Tue, 03 Jul 2001 10:49:34 +0200

Hello paul,

"Pedriana, Paul" a écrit :
> 
> Given a font, I want to know if it will be able to draw
> (e.g.) Cyrillic characters with it. I can't know ahead of
> time exactly what characters will be needed, but I do
> have some confidence that if the font has most of the
> common characters for one language, it is going to
> be good enough for me to use.
> 
> Is there a machanism within Freetype to help out telling
> what character sets a font supports? Or do I just pick
> some representative characters and call FT_Get_Char_Index
> and check the return value?
>
Well, there is no standard scheme to do what you want.
Even if some font formats have some support for what you
describe, it is generally not implemented correctly within
the fonts :-(

There are basically two kinds of solutions:

  - the non-format specific one is to try to call
    FT_Get_Char_Index with a set of carefully selected
    character codes for the languages that interest you,
    and hope that everything works well (it usually does,
    except when you use very weird fonts)

  - otherwise, you'll need all sorts of format-specific
    tricks, in order to dive in the FreeType internals in
    order to analyze charset/coverage information on
    each font..

    that clearly is a lot more difficult, and I wouldn't
    recommend it unless you're writing your own text layout
    engine. We have not added such a "feature" to FreeType
    itself for various reasons. One being lack of time..
 
> Unrelated question: How do you tell from a C program what
> the code page is of the input? If I write a program and start
> receiving characters (multi-byte in particular), I want to know
> what code page they are so I can convert them to Unicode
> and get on with processing. Microsoft's VC++ has a function
> called _getmbcp (in mbctype.h) that does this, but I don't
> thing this exists on other platforms.
>
The ANSI libc provides "locale" specific functions that should
help you. Other than that, I believe that all other interfaces
are system-specific..

Regards,

- David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]