[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Freetype] rendering a string, using outlines, in mono
From: |
Turner, David |
Subject: |
RE: [Freetype] rendering a string, using outlines, in mono |
Date: |
Wed, 13 Oct 2004 10:18:03 +0200 |
> hello,
>
> i want to render a string, on 1-bit bitmap, using the outlines of the
> glyph (FT_Outline_Get_Bitmap). I have 2 questions:
>
> 1) when i render the string in a big bitmap (say, the BBox,
> which i have computed before rendering), only the last character is
> rendered. It seems that at each call of FT_Outline_Get_Bitmap, this one clear
> the bitmap that i give to it. Is it the case ? Does it only create
> "standalone" bitmap
> ? (from the doc: "Renders an outline within a bitmap. The outline's image
> is simply OR-ed to the target bitmap")
>
It's difficult to answer without seeing your code, but all I can say is the
following:
- the bitmap _should_ be or-ed to the target surface
- you can check it rather easily, just fill your target bitmap
with a random value (e.g. 0x55), then draw in it. The result
will tell you quite easily if something was overwritten :-)
> 2) the second question is related to the translation of a outline. I
> wanted to translate the characters of the strind, with FT_Outline_Translate,
> but, it seems that if i give the vector in pixel unit, it's not sufficient.
> I have to multiply the value of the offset that i give (that is, the pen
> position,
> expressed) by something like 4. I don't understand why this factor arises
> (why 4,
> and not 1<<6, as the coords of an outline is expressed in 26.6 format)
>
That's strange, because:
- FT_Outline_Translate only performs addition on the vector coordinates
stored in the outline. It doesn't know anything about scaling
- by default, hinted/scaled outlines are stored with 1/64 pixels accuracy,
which means that you need to multiply pixel distances by 64 before
passing them to FT_Outline_Translate.
- unscaled outlines are expressed in "EM" units, so you should express
your translation in the EM space to call FT_Outline_Translate
I don't see where your 4 factor comes from. Did you scale the outlines
yourself ?
Hope this helps,
- David Turner
- The FreeType Project (www.freetype.org)