[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
top
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
0
and row 656, so there are 657 addressable rows.
But when I render it to a bitmap in freetype, I get bitmap.rows ==
656,
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
to
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
address@hidden
https://lists.nongnu.org/mailman/listinfo/freetype
- [ft] Off by one error in freetype (or in programmer?), Simon Cozens, 2018/04/05
- Re: [ft] Off by one error in freetype (or in programmer?),
Ladislav Dudáš <=
- Re: [ft] Off by one error in freetype (or in programmer?), Werner LEMBERG, 2018/04/05
- Re: [ft] Off by one error in freetype (or in programmer?), Simon Cozens, 2018/04/05
- Re: [ft] Off by one error in freetype (or in programmer?), Werner LEMBERG, 2018/04/05
- Re: [ft] Off by one error in freetype (or in programmer?), Lawrence D'Oliveiro, 2018/04/05
- Re: [ft] Off by one error in freetype (or in programmer?), Werner LEMBERG, 2018/04/06
- Re: [ft] Off by one error in freetype (or in programmer?), Lawrence D'Oliveiro, 2018/04/06
- Re: [ft] Off by one error in freetype (or in programmer?), Werner LEMBERG, 2018/04/06
- Re: [ft] Off by one error in freetype (or in programmer?), Lawrence D'Oliveiro, 2018/04/06
- Re: [ft] Off by one error in freetype (or in programmer?), Dave Arnold, 2018/04/06