Skip to content

FreeType rasterization doesn't work, and has been made mandatory #685

Closed

Description

This is a priority issue for me because it's blocking the Tsukurimashou 0.8 release, planned for tomorrow. Encountered in the latest git master version of FontForge, under 64-bit Linux.

Same problem I reported two years ago to the mailing list (http://sourceforge.net/mailarchive/forum.php?thread_name=20111125.100615.444195158.wl%40gnu.org&forum_name=fontforge-devel ): when FontForge uses FreeType to generate bitmaps, it sometimes produces complete garbage. The bitmaps, if saved to BDF, are mostly empty, with just a few containing large irregular black areas. If I generate a bitmap strike in the GUI and then try to look at it in the bitmap window, it sometimes segfaults, suggesting in-memory data structures contain garbage.

The file I posted for that bug report is no longer online, but I've posted a fresh one at https://github.com/fontforge/debugfonts/blob/master/jieub-bt-ps.sfd

In the GUI, there is an option during bitmap generation to use FreeType or not; but native scripting doesn't offer such a choice and will always attempt to use FreeType.

Werner Lemberg found and fixed an unrelated bug in FreeType in response to my report (see the mailing list thread) - apparently FreeType couldn't read BDF files with large indices. But FontForge does not use FreeType for BDF files; that bug is unrelated to mine and only happened to also be noticeable from the test case I provided. He disclaimed responsibility for my actual bug, which is specific to the case where FontForge generates a bitmap using FreeType.

In 2011, a workaround for me was to build FontForge without FreeType. But pull #157 made that impossible.

At this point it looks to me like my best option may be to dig into the FontForge source and modify the hardcoded "use FreeType" setting to "no," because I need this to work now. But in the longer term, we should figure out what's actually wrong with the FreeType rasterization and fix it, or convince Werner that it is his business to do so.

Activity

  1. lemzwerg commented on Aug 26, 2013

    @lemzwerg
    Member

    Same problem I reported two years ago to the mailing list
    (http://sourceforge.net/mailarchive/forum.php?thread_name=20111125.100615.444195158.wl%40gnu.org&forum_name=fontforge-devel):
    when FontForge uses FreeType to generate bitmaps, it sometimes
    produces complete garbage. The bitmaps, if saved to BDF, are mostly
    empty, with just a few containing large irregular black areas. If I
    generate a bitmap strike in the GUI and then try to look at it in
    the bitmap window, it sometimes segfaults, suggesting in-memory data
    structures contain garbage.

    If you can provide a backtrace, this would be very helpful, since it
    helps identify a not directly related display bug in FontForge.

    [...] But in the longer term, we should figure out what's actually
    wrong with the FreeType rasterization and fix it, or convince Werner
    that it is his business to do so.

    If you can give me data related to FreeType to work on, I'm
    certainly fixing any issue. However, I don't have time and enough
    knowledge, unfortunately, to read FontForge's code in detail.

    I still have doubts whether this is a FreeType issue: Currently, there
    are no known FreeType rendering problems. I rather suspect that
    FontForge's code to generate the BDF data from the rendered bitmaps is
    buggy.

    Werner
    
  2. davelab6 commented on Aug 26, 2013

    @davelab6
    Member

    Would a --configure flag be useful? So that you have to intentionally say you dont have FreeType, and if you don't say that, the build fails?

  3. davelab6 commented on Aug 26, 2013

    @davelab6
    Member

    So this issue is really two tasks?

  4. davelab6 commented on Aug 26, 2013

    @davelab6
    Member

    So, 4?

    • Add a native scripting option that matches the GUI option
    • Add a python scripting option that matches the GUI option
    • Fix the generation of bitmaps with freetype
    • Fix the crash if it still happens after the above is fixed
  5. lemzwerg commented on Aug 26, 2013

    @lemzwerg
    Member

    So the bitmaps are incorrect very soon after they come out of
    FreeType, though it remains possible that they could be correct
    when they come out of FreeType, with FontForge corrupting them
    very soon after that point.

    It should be straightforward to immediately send the bitmaps created
    by FreeType to a series of debugging log files (one glyph per file,
    where image bits can be represented with `*' or something similar).
    Doing so it can be checked easily whether FreeType produces buggy
    output.

    Werner
    
  6. davelab6 commented on Sep 13, 2013

    @davelab6
    Member

    Perhaps the best fix is to check if there are more than 1000 glyphs being processed and if so, alert the user that only the first 1000 are processed, and just process them?

  7. davelab6 commented on Sep 14, 2013

    @davelab6
    Member

    Have you used a libre word processor? ;)

  8. 33 remaining items

  9. lemzwerg commented on Mar 4, 2015

    @lemzwerg
    Member

    Maybe FontForge can create an intermediate CFF instead of a PFB?

  10. lemzwerg commented on Mar 5, 2015

    @lemzwerg
    Member

    It's a non-issue in CFF because you don't need hint replacement subroutines at all. Instead, there is the hintmask operator (and cntrmask, for which there is no equivalent in Type 1 fonts).

    The availability of large integers is another bonus but not important here, I guess.

  11. KrasnayaPloshchad commented on Mar 24, 2015

    @KrasnayaPloshchad

    I found Wikipedia article explained FreeType’s subpixel rendering implementation is currently disabled by default to avoid Microsoft's patent about a specific color filtering algorithm for use in LCD display subpixel rendering.

  12. lemzwerg commented on Mar 25, 2015

    @lemzwerg
    Member

    While the statement itself is true, it's not clear to me what the last comment wants to tell us...

  13. ghlawrence2000 commented on Jul 5, 2015

    @ghlawrence2000

    Sorry, was a freetype problem I just posted in great detail before i realised this was fontforge area

  14. added 2 commits that reference this issue on Jul 11, 2015
    2d062fc
    f468b1c
  15. ghost added a commit that references this issue on Jul 12, 2015
    fb32269
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions