freetype
[Top][All Lists]
Advanced

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

Re: [ft] FreeType and Direct X (was: License question)


From: Iñaki Castillo Arteta
Subject: Re: [ft] FreeType and Direct X (was: License question)
Date: Wed, 9 Jan 2013 16:03:50 +0100

Having ported FT to Windows in the past, I would tell there is no much extra 
work you need to do to use FT under DirectX.
My approach was to have renderings as cached as possible and then work with 
background blending for each case.
In other words, you will have already rendered fonts, producing grayscale 
bitmaps on one side, and your DirectX display surface on the other side. Once 
you have both things, it will be as easy as deling with a grayscale bitmapped 
graphics o DirectX.



-----Mensaje original-----
De: address@hidden [mailto:address@hidden En nombre de Werner LEMBERG
Enviado el: miércoles, 09 de enero de 2013 14:47
Para: address@hidden
CC: address@hidden
Asunto: [ft] FreeType and Direct X (was: License question)


[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

_______________________________________________
Freetype mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/freetype



reply via email to

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