[Top][All Lists]

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

Re: [ft] Off by one error in freetype (or in programmer?)

From: Ladislav Dudáš
Subject: Re: [ft] Off by one error in freetype (or in programmer?)
Date: Thu, 05 Apr 2018 12:36:35 +0200

   Hello Simon,
   You compute correctly width (472) and height (656) of bitmap. So
   addressable rows are 0 to 655 (included) - row 0 is 1st line, row 1 is
   2nd line and so on. So you cannot access row 656 which is 657th line.
   - Laco.
   Dňa 5.4.2018 11:14 AM použÃvateľ Simon Cozens
   <address@hidden> napÃsal:

     So, I may be about to embarrass myself, because fencepost errors are
     like that, but here goes.
     If I look at the glyph /H in Source Sans Pro in a font editor, the
     right bound is a point at (562,656) and the bottom left point is at
     (90,0). If I were to think about this as a bitmap, I can address row
     and row 656, so there are 657 addressable rows.
     But when I render it to a bitmap in freetype, I get bitmap.rows ==
     bitmap.width == 472 (562 minus the LSB of 90 is 472).
     I seem to have lost a row somewhere - I can only address from rows 0
     655. For example, this bitmap is an array with bitmap.rows *
     bitmap.width = 309632 elements. If I wanted to address the top right
     point,  I would set:
     y = 656
     x = 472
     and then address:
     bitmap[ y * bitmap.width + x ]
              bitmap[ 310104 ]
     and oops, I'm off the end of the array.
     Is this a problem with freetype, or in my assumptions?
     Freetype mailing list

reply via email to

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