Forum > LazUtils

[LazFreeType] Resource Font

<< < (4/5) > >>

circular:
Thanks for testing.  :)


--- Quote from: Vladimyr on February 08, 2013, 05:50:18 pm ---excuse me, but one question is left: can it work with BGRATextFX?
--- End quote ---
Ok. I've updated BGRABitmap on subversion, now in TBGRAFreeTypeDrawer, you have a CreateTextEffect function.


--- Quote ---but even if i set font collection, how to select one font between the other ones?
or the font from resource stream still can be used somehow?
--- End quote ---
Ok. Here is a patch to add a font from a stream into a font collection.

Can you give it a try ?

circular:
@ask:

Ok now I got some range check errors, when running LazUtils with range check option.

It appears that variable types are not consistent with loading instruction from the frame buffer.

Ask:

--- Quote ---I tested it with some files.
--- End quote ---
Can you post your test program?


--- Quote ---Ok. Here is a patch to add a font from a stream into a font collection.
--- End quote ---
Hm. Note that:
1) Init procedure is redundant, since class members are auto-zeroed on construction.
2) TFreeTypeFontCollection.AddStream has 90% common code with AddFile.

I could fix both problems myself, but I need a test :)


--- Quote ---very strange commit.... the patch uploaded here does not contain 'A Count'
--- End quote ---
Sorry about that.

circular:
Here is test program for AddStream.

Note that you need to copy in timesi.ttf (Times New Roman Italic) and arial.ttf (Arial Regular).

Vladimyr:
Finally, I got everything working.

Correct approach was to create a default font collection,
add several fonts into it from resource stream, set this
collection as default one, and select each font via

--- Code: ---xxx.FontName
--- End code ---
referring to its internal name (not file name nor resource name).

Also, too many ways to draw text make things a bit complicated
for beginners. These ones are:

--- Code: ---BGRABitmap.TextOut (...)
BGRAFreeTypeDrawer.DrawText (...)
BGRAVectorizedFontRenderer.TextOut (...)
BGRATextEffect.Draw (...)
--- End code ---

Now I use the 4th variant, but it could be interesting to learn
the difference. What I discovered for now:
1) can draw shadow, can't use stream font;
2) can't draw shadow, can use stream font;
3) can draw shadow, can't use stream font;
4) can draw shadow, can use stream font.

Hope it will be useful to know that for somebody.
Thank you again for your inestimable work!  8)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version