[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft] FreeType and Direct X (was: License question)
From: |
Werner LEMBERG |
Subject: |
[ft] FreeType and Direct X (was: License question) |
Date: |
Wed, 09 Jan 2013 14:46:41 +0100 (CET) |
[CCing the freetype mailing list.]
> However, there seems to be not a single project utilizing the
> FreeType library in MS DirectX projects. I concentrate in DirectX
> in my engine and so help here would have been useful... however,
> non-existent.
Well, I'm working almost exclusively on GNU/Linux, and most
contributors are also working on Unix-like operating systems. IIRC,
there was not a single report on the FreeType mailing lists about
using FreeType in combination with Direct X.
I would be glad if you could share your experience on the list after
you are done (this is, probably post a link to your blog describing
the steps you've done to make FreeType work with Direct X)!
> As suggested in many tutorials/examples I used the following
> approach to get rendered glyph bitmaps:
>
> 1) FT_Init_FreeType
> 2) FT_New_Face
> 3) FT_Set_Char_Size (using height=16<<6 and hdpi=vdpi=96)
> 4) FT_Load_Glyph (1~127)
> 5) FT_Get_Glyph
> 6) FT_Glyph_To_Bitmap
>
> The output from the bitmap buffer went into a A8R8G8B8 DX-texture
> and is indeed rendered by the DirectX-engine, where i put the
> texture on two triangles with dimensions equal to the font size I
> get from the bitmap dimensions.
>
> Even after applying all possible filtering enhancements (linear,
> bilinear, anisotropic,...) the results are bad.
>
> I tried various fonts (arial.ttf, msgothic.ttc, ObelixPro.ttf, etc.)
> though.
>
> However, the bigger the font-height is set the more good-looking the
> rendered bitmaps become. Arriving at e.g. 120<<6 the generated
> bitmaps look VERY good already.
>
> However, I need small fonts and as it looks, scaling from 120 down
> to 16 via the 3D-engines own scaling mechanisms only creates
> artifacts, especially if filtering is applied.
>
> Is there no way of having Freetype create very clear bitmaps in the
> small range of sizes (say font height 8)????
To get `clear bitmaps' you have to activate hinting with most fonts.
Try, say, MS Arial which has excellent bytecode, and which should give
very good results at small sizes.
I suggest that you have a look how the demo programs like ftview or
ftdiff work. There you can switch on and off the various rendering
options.
> I guess you would not know of any available book or tutorial for
> Freetype in conjunction with DirectX?????
Maybe other users can share some thoughts...
Werner