[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft] Fw: [ft-devel] fitting a text
From: |
folkert |
Subject: |
Re: [ft] Fw: [ft-devel] fitting a text |
Date: |
Fri, 12 Jun 2015 09:58:17 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
> My code prints out the computed bitmap dimensions (including
> fractions); do the numbers agree with what you calculate?
Totally different. Also your script emits different values from my code.
I converted your python script to c++:
your script:
char 95 wxh = 6x1 ascender -1 bearingx -1 kern 0
char 103 wxh = 6x7 ascender 5 bearingx 0 kern 0
char 113 wxh = 6x6 ascender 5 bearingx 0 kern 0
char 116 wxh = 3x6 ascender 6 bearingx 0 kern 0
char 101 wxh = 5x5 ascender 5 bearingx 0 kern 0
char 115 wxh = 5x5 ascender 5 bearingx 0 kern 0
char 116 wxh = 3x6 ascender 6 bearingx 0 kern 0
char 49 wxh = 6x7 ascender 7 bearingx 2 kern 0
char 50 wxh = 6x7 ascender 7 bearingx 1 kern 0
char 51 wxh = 6x7 ascender 7 bearingx 0 kern 0
bitmap dimensions wxh = 52x9
my c++ version:
char 95 wÃh = 64Ã64 ascender 0 bearingx -64 kern 0
char 103 wÃh = 64Ã128 ascender 64 bearingx 0 kern 0
char 113 wÃh = 64Ã128 ascender 64 bearingx 0 kern 0
char 116 wÃh = 0Ã128 ascender 64 bearingx 0 kern 0
char 101 wÃh = 64Ã128 ascender 64 bearingx 0 kern 0
char 115 wÃh = 64Ã128 ascender 64 bearingx 0 kern 0
char 116 wÃh = 0Ã128 ascender 64 bearingx 0 kern 0
char 49 wÃh = 64Ã64 ascender 64 bearingx 0 kern 0
char 50 wÃh = 64Ã64 ascender 64 bearingx 0 kern 0
char 51 wÃh = 64Ã128 ascender 64 bearingx 0 kern 0
bitmap dimensions wÃh = 512Ã128
Even when ignoring the multiple-of-64 it is totally different.
I checked that I'm using the same font-file.
w = 0;
int max_ascender = 0, max_descender = 0;
int prev_glyph_index = -1;
for(unsigned int n = 0; n < text.size(); n++)
{
// same problem with FT_LOAD_DEFAULT
if (FT_Load_Char(face, text.at(n), FT_LOAD_RENDER))
continue;
int glyph_index = FT_Get_Char_Index(face, text.at(n));
int kern = 0;
if (prev_glyph_index != -1)
{
FT_Vector akern;
FT_Get_Kerning(face, prev_glyph_index, glyph_index,
FT_KERNING_DEFAULT, &akern);
kern = akern.x;
}
w += face -> glyph -> metrics.horiAdvance + kern;
max_ascender = std::max(max_ascender, int(face -> glyph ->
metrics.horiBearingY));
max_descender = std::max(max_descender, int(face -> glyph ->
metrics.height - face -> glyph -> metrics.horiBearingY));
printf("char %d wÃh = %dÃ%d ascender %d bearingx %d kern
%d\n", text.at(n), face -> glyph -> metrics.horiAdvance, face -> glyph ->
metrics.height, face -> glyph -> metrics.horiBearingY, face -> glyph ->
metrics.horiBearingX, kern);
prev_glyph_index = glyph_index;
}
h = max_ascender + max_descender;
printf("bitmap dimensions wÃh = %dÃ%d\n", w, h);
Folkert van Heusden
--
To MultiTail einai ena polymorfiko ergaleio gia ta logfiles kai tin
eksodo twn entolwn. Prosferei: filtrarisma, xrwmatismo, sygxwneysi,
diaforetikes provoles. http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
- [ft] Fw: [ft-devel] fitting a text, Werner LEMBERG, 2015/06/05
- Re: [ft] Fw: [ft-devel] fitting a text, Lawrence D'Oliveiro, 2015/06/05
- Re: [ft] Fw: [ft-devel] fitting a text, folkert, 2015/06/07
- Re: [ft] Fw: [ft-devel] fitting a text, Lawrence D'Oliveiro, 2015/06/07
- Re: [ft] Fw: [ft-devel] fitting a text, folkert, 2015/06/11
- Re: [ft] Fw: [ft-devel] fitting a text, Lawrence D'Oliveiro, 2015/06/11
- Re: [ft] Fw: [ft-devel] fitting a text,
folkert <=
- Re: [ft] Fw: [ft-devel] fitting a text, Lawrence D'Oliveiro, 2015/06/12
- Re: [ft] Fw: [ft-devel] fitting a text, folkert, 2015/06/12
- Re: [ft] Fw: [ft-devel] fitting a text, Lawrence D'Oliveiro, 2015/06/12
- Re: [ft] Fw: [ft-devel] fitting a text, folkert, 2015/06/12
- Re: [ft] Fw: [ft-devel] fitting a text, folkert, 2015/06/12
- Re: [ft] Fw: [ft-devel] fitting a text, folkert, 2015/06/12
- Re: [ft] Fw: [ft-devel] fitting a text, Lawrence D'Oliveiro, 2015/06/12