Menu

TrueType Font

Help
AlaLab
2010-02-20
2012-10-16
  • AlaLab

    AlaLab - 2010-02-20

    Hello,
    I find that text rendering not very beautifull under windows. :(
    I attached a screenshot with some texts on
    it

    I changed

    ifdef WIN32 // a man ask to use built-in font under Windows

    define MGL_DEF_FONT_NAME 0

    else

    to

    define MGL_DEF_FONT_NAME "STIX"

    and

    define MGL_FONT_PATH "G:\Projets\mathgl\fonts\"

    But the result is the same.

    Can we make MathGl use truetype fonts ?

    Best regards,

    Alaa

     
  • AlaLab

    AlaLab - 2010-02-21

    Hello,
    I made a test by drawing using the windows GDI function TextOut() on the
    birmap used by mathgl.
    This image shows the result using a default Font :

    And this using a bigger Font
    :

    Some open source libraries make a very nice text drawing with transparency
    like graphics32 (http://graphics32.org/wiki/)
    here is a screenshot :

    Regards,
    Alaa

     
  • Alexey Balakin

    Alexey Balakin - 2010-02-21

    Hi Alaa,

    it seems that you use RGBA pictures for drawing. At this many of Windows
    applications (including GDI as I remember) handle transparency incorrectly.
    So, I suggest you to use the image without Alpha-channel -- use GetBits()
    function.

    Concerning the graphics32 library (and similar) -- it is not cross-platform
    library and I will not use it into MathGL.

    Alexey

     
  • AlaLab

    AlaLab - 2010-02-21

    Hi Alexey,

    Right. How did you guess that I'm using RGBA ? :)

    I'm not criticizing the mathgl graphics quality. The library is great.
    I think that its weak point is font rendering.
    Here agin an illustraive example :

    I gave the example of graphics32 as an example of good quality true type
    rendering into a bitmap. The G32_text does not use plateform dependant
    function I think. It converts the text to polygons and draw the polygons in
    the bitmap pixels.
    May be the freetype library
    (http://www.freetype.org)is good solution for cross
    platform.

    BTW, How do you generate the VFM Fonts ?

    Alaa

     
  • Alexey Balakin

    Alexey Balakin - 2010-02-21

    Hi, Alaa

    Right. How did you guess that I'm using RGBA ? :)
    I met (and was reported) that windows GDI cannot handle transparency. I've
    seen very sharp letters and lines from yours figures and concluded that you
    use RGB channels and miss A channel -- usual bug for GDI.

    I think that its weak point is font rendering.
    You can look on GetBits() result and see that rendering is not so bad (see any
    pictures in http://mathgl.sourceforge.net/pictures.html)

    Here agin an illustraive example :
    You again use RGBA image in GDI.

    May be the freetype library
    (http://www.freetype.org)is good solution for
    cross platform.

    Yes, this is one of few good library. But it have a lot of dependencies ...
    So, at this moment I decide to use my own render.

    BTW, How do you generate the VFM Fonts ?
    https://sourceforge.net/projects/mathgl/files/mathgl%20addon/mathgl%20addon/f
    ont_tools-1.0.tgz/download

    Alexey

     

Log in to post a comment.