Mercurial > emacs
comparison src/w32term.c @ 33037:365605845e33
(w32_bdf_per_char_metric): Negate descent.
(w32_cache_char_metrics): Handle possibility that 'x' does not
exist in a BDF font.
(W32_TEXTOUT): w32_BDF_TextOut wants number of bytes not chars.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Sun, 29 Oct 2000 20:59:47 +0000 |
parents | c3435dc00ed7 |
children | 84590a646acc |
comparison
equal
deleted
inserted
replaced
33036:9fa317523a69 | 33037:365605845e33 |
---|---|
1148 pcm->width = bdf_metric->dwidth; | 1148 pcm->width = bdf_metric->dwidth; |
1149 pcm->lbearing = bdf_metric->bbox; | 1149 pcm->lbearing = bdf_metric->bbox; |
1150 pcm->rbearing = bdf_metric->dwidth | 1150 pcm->rbearing = bdf_metric->dwidth |
1151 - (bdf_metric->bbox + bdf_metric->bbw); | 1151 - (bdf_metric->bbox + bdf_metric->bbw); |
1152 pcm->ascent = bdf_metric->bboy + bdf_metric->bbh; | 1152 pcm->ascent = bdf_metric->bboy + bdf_metric->bbh; |
1153 pcm->descent = bdf_metric->bboy; | 1153 pcm->descent = -bdf_metric->bboy; |
1154 | 1154 |
1155 return 1; | 1155 return 1; |
1156 } | 1156 } |
1157 return 0; | 1157 return 0; |
1158 } | 1158 } |
1278 | 1278 |
1279 /* Cache char metrics for the common cases. */ | 1279 /* Cache char metrics for the common cases. */ |
1280 if (font->bdf) | 1280 if (font->bdf) |
1281 { | 1281 { |
1282 /* TODO: determine whether font is fixed-pitch. */ | 1282 /* TODO: determine whether font is fixed-pitch. */ |
1283 w32_bdf_per_char_metric (font, &char2b, 1, &font->max_bounds); | 1283 if (!w32_bdf_per_char_metric (font, &char2b, 1, &font->max_bounds)) |
1284 { | |
1285 /* Use the font width and height as max bounds, as not all BDF | |
1286 fonts contain the letter 'x'. */ | |
1287 font->max_bounds.width = FONT_MAX_WIDTH (font); | |
1288 font->max_bounds.lbearing = -font->bdf->llx; | |
1289 font->max_bounds.rbearing = FONT_MAX_WIDTH (font) - font->bdf->urx; | |
1290 font->max_bounds.ascent = FONT_BASE (font); | |
1291 font->max_bounds.descent = FONT_DESCENT (font); | |
1292 } | |
1284 } | 1293 } |
1285 else | 1294 else |
1286 { | 1295 { |
1287 if (((font->tm.tmPitchAndFamily & TMPF_FIXED_PITCH) != 0) | 1296 if (((font->tm.tmPitchAndFamily & TMPF_FIXED_PITCH) != 0) |
1288 /* Some fonts (eg DBCS fonts) are marked as fixed width even | 1297 /* Some fonts (eg DBCS fonts) are marked as fixed width even |
2368 int nchars; | 2377 int nchars; |
2369 { | 2378 { |
2370 int charset_dim = w32_font_is_double_byte (s->gc->font) ? 2 : 1; | 2379 int charset_dim = w32_font_is_double_byte (s->gc->font) ? 2 : 1; |
2371 if (s->gc->font->bdf) | 2380 if (s->gc->font->bdf) |
2372 w32_BDF_TextOut (s->gc->font->bdf, s->hdc, | 2381 w32_BDF_TextOut (s->gc->font->bdf, s->hdc, |
2373 x, y, (char *) chars, charset_dim, nchars, 0); | 2382 x, y, (char *) chars, charset_dim, |
2383 nchars * charset_dim, 0); | |
2374 else if (s->first_glyph->w32_font_type == UNICODE_FONT) | 2384 else if (s->first_glyph->w32_font_type == UNICODE_FONT) |
2375 ExtTextOutW (s->hdc, x, y, 0, NULL, chars, nchars, NULL); | 2385 ExtTextOutW (s->hdc, x, y, 0, NULL, chars, nchars, NULL); |
2376 else | 2386 else |
2377 ExtTextOut (s->hdc, x, y, 0, NULL, (char *) chars, | 2387 ExtTextOut (s->hdc, x, y, 0, NULL, (char *) chars, |
2378 nchars * charset_dim, NULL); | 2388 nchars * charset_dim, NULL); |