aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2007-05-31 00:59:50 +0000
committerJason Rumney2007-05-31 00:59:50 +0000
commitb70be25344bc90a2b99cf8e0e8d04f2a2634f957 (patch)
tree4c231b13bd210b58330acfcda8a17c2d71c9d636 /src
parent47e420b58081680be9a4dd409bdbdee917bc5bd5 (diff)
downloademacs-b70be25344bc90a2b99cf8e0e8d04f2a2634f957.tar.gz
emacs-b70be25344bc90a2b99cf8e0e8d04f2a2634f957.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/w32term.c b/src/w32term.c
index 604de982f50..2d3969001d8 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -62,6 +62,7 @@ Boston, MA 02110-1301, USA. */
62 62
63#ifdef USE_FONT_BACKEND 63#ifdef USE_FONT_BACKEND
64#include "font.h" 64#include "font.h"
65void w32font_initialize P_ ((void));
65#endif /* USE_FONT_BACKEND */ 66#endif /* USE_FONT_BACKEND */
66 67
67#define abs(x) ((x) < 0 ? -(x) : (x)) 68#define abs(x) ((x) < 0 ? -(x) : (x))
@@ -979,8 +980,8 @@ w32_native_per_char_metric (font, char2b, font_type, pcm)
979 980
980 if (retval) 981 if (retval)
981 { 982 {
982 pcm->width = sz.cx - font->tm.tmOverhang; 983 pcm->width = sz.cx;
983 pcm->rbearing = sz.cx; 984 pcm->rbearing = sz.cx + font->tm.tmOverhang;
984 pcm->lbearing = 0; 985 pcm->lbearing = 0;
985 pcm->ascent = FONT_BASE (font); 986 pcm->ascent = FONT_BASE (font);
986 pcm->descent = FONT_DESCENT (font); 987 pcm->descent = FONT_DESCENT (font);
@@ -1836,14 +1837,10 @@ x_draw_glyph_string_foreground (s)
1836#ifdef USE_FONT_BACKEND 1837#ifdef USE_FONT_BACKEND
1837 else if (enable_font_backend) 1838 else if (enable_font_backend)
1838 { 1839 {
1839 unsigned *code = alloca (sizeof (unsigned) * s->nchars);
1840 int boff = s->font_info->baseline_offset; 1840 int boff = s->font_info->baseline_offset;
1841 struct font *font = (struct font *) s->font_info; 1841 struct font *font = (struct font *) s->font_info;
1842 int y; 1842 int y;
1843 1843
1844 for (i = 0; i < s->nchars; i++)
1845 code[i] = (s->char2b[i].byte1 << 8) | s->char2b[i].byte2;
1846
1847 if (s->font_info->vertical_centering) 1844 if (s->font_info->vertical_centering)
1848 boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff; 1845 boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff;
1849 1846
@@ -2875,7 +2872,7 @@ x_draw_glyph_string (s)
2875 && (s->font->bdf || !s->font->tm.tmUnderlined)) 2872 && (s->font->bdf || !s->font->tm.tmUnderlined))
2876 { 2873 {
2877 unsigned long h; 2874 unsigned long h;
2878 unsigned long dy = 0; 2875 int y;
2879 /* Get the underline thickness. Default is 1 pixel. */ 2876 /* Get the underline thickness. Default is 1 pixel. */
2880#ifdef USE_FONT_BACKEND 2877#ifdef USE_FONT_BACKEND
2881 if (enable_font_backend) 2878 if (enable_font_backend)
@@ -2897,28 +2894,29 @@ x_draw_glyph_string (s)
2897 else 2894 else
2898#endif 2895#endif
2899 { 2896 {
2900 if (x_underline_at_descent_line) 2897 y = s->y + s->height - h;
2901 dy = s->height - h; 2898 /* TODO: Use font information for positioning and
2902 else 2899 thickness of underline. See OUTLINETEXTMETRIC,
2900 and xterm.c. Note: If you make this work,
2901 don't forget to change the doc string of
2902 x-use-underline_color-position-properties
2903 below. */
2904#if 0
2905 if (!x_underline_at_descent_line)
2903 { 2906 {
2904 /* TODO: Use font information for positioning and 2907 ...
2905 thickness of underline. See OUTLINETEXTMETRIC,
2906 and xterm.c. Note: If you makedev this work,
2907 don't forget to change the doc string of
2908 x-use-underline_color-position-properties
2909 below. */
2910 dy = s->height - h;
2911 } 2908 }
2909#endif
2912 } 2910 }
2913 if (s->face->underline_defaulted_p) 2911 if (s->face->underline_defaulted_p)
2914 { 2912 {
2915 w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, 2913 w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x,
2916 s->y + dy, s->background_width, 1); 2914 y, s->background_width, 1);
2917 } 2915 }
2918 else 2916 else
2919 { 2917 {
2920 w32_fill_area (s->f, s->hdc, s->face->underline_color, s->x, 2918 w32_fill_area (s->f, s->hdc, s->face->underline_color, s->x,
2921 s->y + dy, s->background_width, 1); 2919 y, s->background_width, 1);
2922 } 2920 }
2923 } 2921 }
2924 /* Draw overline. */ 2922 /* Draw overline. */
@@ -7002,6 +7000,11 @@ w32_initialize ()
7002 && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0) 7000 && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0)
7003 && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE; 7001 && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE;
7004 } 7002 }
7003
7004#ifdef USE_FONT_BACKEND
7005 w32font_initialize ();
7006
7007#endif
7005} 7008}
7006 7009
7007void 7010void