Commit b70be253 authored by Jason Rumney's avatar Jason Rumney

(w32_native_per_char_metric): Swap width and rbearing

calculations for non-Truetype fonts.
(x_draw_glyph_string): Sync with xterm.c.
(x_draw_glyph_string_foreground) [USE_FONT_BACKEND]: Remove
redundant code.
(w32_initialize) [USE_FONT_BACKEND]: Call w32font_initialize.
parent 47e420b5
...@@ -62,6 +62,7 @@ Boston, MA 02110-1301, USA. */ ...@@ -62,6 +62,7 @@ Boston, MA 02110-1301, USA. */
#ifdef USE_FONT_BACKEND #ifdef USE_FONT_BACKEND
#include "font.h" #include "font.h"
void w32font_initialize P_ ((void));
#endif /* USE_FONT_BACKEND */ #endif /* USE_FONT_BACKEND */
#define abs(x) ((x) < 0 ? -(x) : (x)) #define abs(x) ((x) < 0 ? -(x) : (x))
...@@ -979,8 +980,8 @@ w32_native_per_char_metric (font, char2b, font_type, pcm) ...@@ -979,8 +980,8 @@ w32_native_per_char_metric (font, char2b, font_type, pcm)
if (retval) if (retval)
{ {
pcm->width = sz.cx - font->tm.tmOverhang; pcm->width = sz.cx;
pcm->rbearing = sz.cx; pcm->rbearing = sz.cx + font->tm.tmOverhang;
pcm->lbearing = 0; pcm->lbearing = 0;
pcm->ascent = FONT_BASE (font); pcm->ascent = FONT_BASE (font);
pcm->descent = FONT_DESCENT (font); pcm->descent = FONT_DESCENT (font);
...@@ -1836,14 +1837,10 @@ x_draw_glyph_string_foreground (s) ...@@ -1836,14 +1837,10 @@ x_draw_glyph_string_foreground (s)
#ifdef USE_FONT_BACKEND #ifdef USE_FONT_BACKEND
else if (enable_font_backend) else if (enable_font_backend)
{ {
unsigned *code = alloca (sizeof (unsigned) * s->nchars);
int boff = s->font_info->baseline_offset; int boff = s->font_info->baseline_offset;
struct font *font = (struct font *) s->font_info; struct font *font = (struct font *) s->font_info;
int y; int y;
for (i = 0; i < s->nchars; i++)
code[i] = (s->char2b[i].byte1 << 8) | s->char2b[i].byte2;
if (s->font_info->vertical_centering) if (s->font_info->vertical_centering)
boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff; boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff;
...@@ -2875,7 +2872,7 @@ x_draw_glyph_string (s) ...@@ -2875,7 +2872,7 @@ x_draw_glyph_string (s)
&& (s->font->bdf || !s->font->tm.tmUnderlined)) && (s->font->bdf || !s->font->tm.tmUnderlined))
{ {
unsigned long h; unsigned long h;
unsigned long dy = 0; int y;
/* Get the underline thickness. Default is 1 pixel. */ /* Get the underline thickness. Default is 1 pixel. */
#ifdef USE_FONT_BACKEND #ifdef USE_FONT_BACKEND
if (enable_font_backend) if (enable_font_backend)
...@@ -2897,28 +2894,29 @@ x_draw_glyph_string (s) ...@@ -2897,28 +2894,29 @@ x_draw_glyph_string (s)
else else
#endif #endif
{ {
if (x_underline_at_descent_line) y = s->y + s->height - h;
dy = s->height - h; /* TODO: Use font information for positioning and
else thickness of underline. See OUTLINETEXTMETRIC,
and xterm.c. Note: If you make this work,
don't forget to change the doc string of
x-use-underline_color-position-properties
below. */
#if 0
if (!x_underline_at_descent_line)
{ {
/* TODO: Use font information for positioning and ...
thickness of underline. See OUTLINETEXTMETRIC,
and xterm.c. Note: If you makedev this work,
don't forget to change the doc string of
x-use-underline_color-position-properties
below. */
dy = s->height - h;
} }
#endif
} }
if (s->face->underline_defaulted_p) if (s->face->underline_defaulted_p)
{ {
w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x,
s->y + dy, s->background_width, 1); y, s->background_width, 1);
} }
else else
{ {
w32_fill_area (s->f, s->hdc, s->face->underline_color, s->x, w32_fill_area (s->f, s->hdc, s->face->underline_color, s->x,
s->y + dy, s->background_width, 1); y, s->background_width, 1);
} }
} }
/* Draw overline. */ /* Draw overline. */
...@@ -7002,6 +7000,11 @@ w32_initialize () ...@@ -7002,6 +7000,11 @@ w32_initialize ()
&& SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0) && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0)
&& smoothing_type == FE_FONTSMOOTHINGCLEARTYPE; && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE;
} }
#ifdef USE_FONT_BACKEND
w32font_initialize ();
#endif
} }
void void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment