[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] CJK Fonts
From: |
Werner LEMBERG |
Subject: |
Re: [Freetype] CJK Fonts |
Date: |
Sun, 11 Feb 2001 18:08:17 +0100 (CET) |
> Moin.
Moinmoin!
> I've read on freetype.org that Freetype has no CJK-Support. But the
> only reason I've downloaded Freetype is to generate JPEGs with
> japanese characters from MSMincho.ttc. So, in a maybe hopeless
> attempt to get a solution I ask here if anyone can tell me how I can
> access the japanese characters in the .ttc.
Maybe you've misunderstood that a bit. FreeType has no CJK support
because it is a library, not a program. It is generic and can accept
any 16bit input encoding, converts it to a glyph index according to
the selected cmap in the font, and rasterizes the glyph. Whether this
is a CJK font or any other font is completely irrelevant.
A simple solution for your problem is to take ftstring.c (from the
`ft2demos' archive) and to modify the function prepare_text() so that
it can accept 16bit entities:
static void prepare_text( const unsigned char* string )
{
const unsigned char* p = (const unsigned char*)string;
PGlyph glyph = glyphs;
FT_UInt glyph_index;
num_glyphs = 0;
while ( *p )
{
if ( !*(++p) )
break;
glyph_index = FT_Get_Char_Index(
face,
(((FT_ULong)*(p - 1)) >> 8) + (FT_ULong)*p);
glyph->glyph_index = glyph_index;
glyph++;
num_glyphs++;
if ( num_glyphs >= MAX_GLYPHS )
break;
p++;
}
}
Now ftstring accepts Unicode input. To convert from, say, SJIS to
Unicode, use e.g. the `uniconv' converter which comes with the `yudit'
editor.
Take a screenshot and convert the image to JPEG.
Werner