- unsharp mask
- make i_conv() clamp the bottom end of the samples range too
(makes it useful for sharpening)
+ - adjust ascender/descender values for FT1.x to avoid losing
+ descenders (specifically the bottom of "g" in ImUgly.ttf or
+ arial.ttf at 14pixels)
=================================================================
mm_log((1,"i_tt_box_inst(handle 0x%X,inst %d,txt '%.*s', len %d)\n",handle,inst,len,txt,len));
upm = handle->properties.header->Units_Per_EM;
- gascent = ( handle->properties.horizontal->Ascender * handle->instanceh[inst].imetrics.y_ppem ) / upm;
- gdescent = ( handle->properties.horizontal->Descender * handle->instanceh[inst].imetrics.y_ppem ) / upm;
+ gascent = ( handle->properties.horizontal->Ascender * handle->instanceh[inst].imetrics.y_ppem + upm - 1) / upm;
+ gdescent = ( handle->properties.horizontal->Descender * handle->instanceh[inst].imetrics.y_ppem - upm + 1) / upm;
width = 0;
start = 0;
if ( i_tt_get_glyph(handle,inst,j) ) {
TT_Glyph_Metrics *gm = handle->instanceh[inst].gmetrics + j;
width += gm->advance / 64;
- casc = gm->bbox.yMax / 64;
- cdesc = gm->bbox.yMin / 64;
+ casc = (gm->bbox.yMax+63) / 64;
+ cdesc = (gm->bbox.yMin-63) / 64;
mm_log((1, "i_tt_box_inst: glyph='%c' casc=%d cdesc=%d\n", j, casc, cdesc));
if (first) {
start = gm->bbox.xMin / 64;
- ascent = gm->bbox.yMax / 64;
- descent = gm->bbox.yMin / 64;
+ ascent = (gm->bbox.yMax+63) / 64;
+ descent = (gm->bbox.yMin-63) / 64;
first = 0;
}
if (i == len-1) {
i_tt_text($ttraw,$backgr,100,100,$bgcolor,50.0,'test',4,1);
+my $ugly = Imager::i_tt_new("./fontfiles/ImUgly.ttf");
+i_tt_text($ugly, $backgr,100, 50, $bgcolor, 14, 'g', 1, 1);
+i_tt_text($ugly, $backgr,150, 50, $bgcolor, 14, 'delta', 5, 1);
+
+
open(FH,">testout/t35ttfont2.ppm") || die "cannot open testout/t35ttfont.ppm\n";
binmode(FH);
$IO = Imager::io_new_fd( fileno(FH) );