summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Rumney <jasonr@gnu.org>2008-06-26 10:48:28 +0000
committerJason Rumney <jasonr@gnu.org>2008-06-26 10:48:28 +0000
commit1b5defe6580487f499c0af4a598ee968c5cae062 (patch)
treefda3244a1c6bcaac61eda98d5429d2d6599ddb57
parentdc018447584eecaf2de92eef2ec3c9f60c5f818f (diff)
downloademacs-1b5defe6580487f499c0af4a598ee968c5cae062.tar.gz
* w32bdf.c, w32bdf.h: Remove obsolete files.
* makefile.w32-in: Remove refs to w32bdf.h and w32bdf.c. * w32gui.h: Don't include w32bdf.h. (XCharStruct, enum w32_char_font_type, W32FontStruct): Remove obsolete font support. * w32font.h (struct w32font_info): Remove compat_w32_font. Add hfont member. (FONT_COMPAT): Remove obsolete macro. * w32font.c (w32font_close): Remove compat code. Delete hfont member. (w32font_encode_char, w32font_text_extents): Use new hfont member. (w32font_open_internal): Remove compat code. Set new hfont member. (Fx_select_font): Use new hfont member. * w32uniscribe.c (uniscribe_otf_capability, uniscribe_shape): (uniscribe_encode_char): Use new hfont member. * w32term.c (x_draw_glyph_string_foreground): (x_draw_composite_glyph_string_foreground): Use new hfont member. (x_draw_glyph_string): Use metrics in w32font_info.
-rw-r--r--src/ChangeLog26
-rw-r--r--src/makefile.w32-in62
-rw-r--r--src/w32bdf.c875
-rw-r--r--src/w32bdf.h128
-rw-r--r--src/w32font.c38
-rw-r--r--src/w32font.h4
-rw-r--r--src/w32gui.h35
-rw-r--r--src/w32term.c29
-rw-r--r--src/w32uniscribe.c6
9 files changed, 54 insertions, 1149 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 158d00d9f0a..e4d5653d4a6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,29 @@
+2008-06-26 Jason Rumney <jasonr@gnu.org>
+
+ * w32bdf.c, w32bdf.h: Remove obsolete files.
+
+ * makefile.w32-in: Remove refs to w32bdf.h and w32bdf.c.
+
+ * w32gui.h: Don't include w32bdf.h.
+ (XCharStruct, enum w32_char_font_type, W32FontStruct):
+ Remove obsolete font support.
+
+ * w32font.h (struct w32font_info): Remove compat_w32_font.
+ Add hfont member.
+ (FONT_COMPAT): Remove obsolete macro.
+
+ * w32font.c (w32font_close): Remove compat code. Delete hfont member.
+ (w32font_encode_char, w32font_text_extents): Use new hfont member.
+ (w32font_open_internal): Remove compat code. Set new hfont member.
+ (Fx_select_font): Use new hfont member.
+
+ * w32uniscribe.c (uniscribe_otf_capability, uniscribe_shape):
+ (uniscribe_encode_char): Use new hfont member.
+
+ * w32term.c (x_draw_glyph_string_foreground):
+ (x_draw_composite_glyph_string_foreground): Use new hfont member.
+ (x_draw_glyph_string): Use metrics in w32font_info.
+
2008-06-26 Kenichi Handa <handa@m17n.org>
* xdisp.c (handle_auto_composed_prop): Fix for the terminal case.
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 1978579354d..116aea2d56d 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -134,7 +134,6 @@ WIN32OBJ = $(BLD)/w32term.$(O) \
$(BLD)/w32select.$(O) \
$(BLD)/w32menu.$(O) \
$(BLD)/w32reg.$(O)
-# $(BLD)/w32bdf.$(O)
FONTOBJ = $(BLD)/w32font.$(O) $(BLD)/w32uniscribe.$(O)
@@ -291,7 +290,6 @@ $(BLD)/abbrev.$(O) : \
$(SRC)/commands.h \
$(SRC)/dispextern.h \
$(SRC)/syntax.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -310,7 +308,6 @@ $(BLD)/alloc.$(O) : \
$(SRC)/process.h \
$(SRC)/puresize.h \
$(SRC)/syssignal.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -338,7 +335,6 @@ $(BLD)/buffer.$(O) : \
$(SRC)/keyboard.h \
$(SRC)/keymap.h \
$(SRC)/region-cache.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -358,7 +354,6 @@ $(BLD)/callint.$(O) : \
$(SRC)/dispextern.h \
$(SRC)/keyboard.h \
$(SRC)/keymap.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -461,7 +456,6 @@ $(BLD)/cmds.$(O) : \
$(SRC)/keyboard.h \
$(SRC)/keymap.h \
$(SRC)/syntax.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -478,7 +472,6 @@ $(BLD)/coding.$(O) : \
$(SRC)/intervals.h \
$(SRC)/frame.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -491,7 +484,6 @@ $(BLD)/composite.$(O) : \
$(SRC)/composite.h \
$(SRC)/dispextern.h \
$(SRC)/intervals.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h
$(BLD)/data.$(O) : \
@@ -544,7 +536,6 @@ $(BLD)/dispnew.$(O) : \
$(SRC)/termchar.h \
$(SRC)/termhooks.h \
$(SRC)/termopts.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32term.h \
$(SRC)/window.h
@@ -579,7 +570,6 @@ $(BLD)/editfns.$(O) : \
$(SRC)/frame.h \
$(SRC)/intervals.h \
$(SRC)/systime.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -602,7 +592,6 @@ $(BLD)/emacs.$(O) : \
$(SRC)/systime.h \
$(SRC)/systty.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32heap.h \
$(SRC)/window.h
@@ -616,7 +605,6 @@ $(BLD)/eval.$(O) : \
$(SRC)/dispextern.h \
$(SRC)/keyboard.h \
$(SRC)/systime.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h
$(BLD)/fileio.$(O) : \
@@ -635,7 +623,6 @@ $(BLD)/fileio.$(O) : \
$(SRC)/dispextern.h \
$(SRC)/intervals.h \
$(SRC)/systime.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -687,7 +674,6 @@ $(BLD)/fns.$(O) : \
$(SRC)/md5.h \
$(SRC)/systime.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -715,7 +701,6 @@ $(BLD)/fontset.$(O) : \
$(SRC)/frame.h \
$(SRC)/keyboard.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -735,7 +720,6 @@ $(BLD)/frame.$(O) : \
$(SRC)/systime.h \
$(SRC)/termchar.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32term.h \
$(SRC)/window.h
@@ -749,7 +733,6 @@ $(BLD)/fringe.$(O) : \
$(SRC)/dispextern.h \
$(SRC)/frame.h \
$(SRC)/systime.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -769,7 +752,6 @@ $(BLD)/image.$(O): \
$(SRC)/frame.h \
$(SRC)/systime.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32heap.h \
$(SRC)/w32term.h \
@@ -792,7 +774,6 @@ $(BLD)/indent.$(O) : \
$(SRC)/region-cache.h \
$(SRC)/termchar.h \
$(SRC)/termopts.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -809,7 +790,6 @@ $(BLD)/insdel.$(O) : \
$(SRC)/intervals.h \
$(SRC)/region-cache.h \
$(SRC)/systime.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -823,7 +803,6 @@ $(BLD)/intervals.$(O) : \
$(SRC)/keyboard.h \
$(SRC)/keymap.h \
$(SRC)/puresize.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h
$(BLD)/keyboard.$(O) : \
@@ -853,7 +832,6 @@ $(BLD)/keyboard.$(O) : \
$(SRC)/termchar.h \
$(SRC)/termhooks.h \
$(SRC)/termopts.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32term.h \
$(SRC)/window.h
@@ -875,7 +853,6 @@ $(BLD)/keymap.$(O) : \
$(SRC)/puresize.h \
$(SRC)/systime.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h
$(BLD)/lastfile.$(O) : \
@@ -899,7 +876,6 @@ $(BLD)/lread.$(O) : \
$(SRC)/intervals.h \
$(SRC)/keyboard.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h
$(BLD)/macros.$(O) : \
@@ -910,7 +886,6 @@ $(BLD)/macros.$(O) : \
$(SRC)/dispextern.h \
$(SRC)/keyboard.h \
$(SRC)/macros.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -952,7 +927,6 @@ $(BLD)/minibuf.$(O) : \
$(SRC)/keymap.h \
$(SRC)/syntax.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -979,7 +953,6 @@ $(BLD)/w32inevt.$(O) : \
$(SRC)/keyboard.h \
$(SRC)/systime.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32heap.h \
$(SRC)/w32term.h
@@ -995,7 +968,6 @@ $(BLD)/w32proc.$(O) : \
$(SRC)/systime.h \
$(SRC)/syswait.h \
$(SRC)/w32.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32heap.h \
$(SRC)/w32term.h
@@ -1011,7 +983,6 @@ $(BLD)/w32console.$(O) : \
$(SRC)/disptab.h \
$(SRC)/frame.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32inevt.h
@@ -1028,7 +999,6 @@ $(BLD)/print.$(O) : \
$(SRC)/keyboard.h \
$(SRC)/process.h \
$(SRC)/termchar.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -1057,7 +1027,6 @@ $(BLD)/process.$(O) : \
$(SRC)/syswait.h \
$(SRC)/termhooks.h \
$(SRC)/termopts.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -1091,7 +1060,6 @@ $(BLD)/scroll.$(O) : \
$(SRC)/keyboard.h \
$(SRC)/termchar.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -1112,7 +1080,6 @@ $(BLD)/search.$(O) : \
$(SRC)/region-cache.h \
$(SRC)/syntax.h \
$(SRC)/systime.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h
$(BLD)/sound.$(O) : \
@@ -1139,7 +1106,6 @@ $(BLD)/syntax.$(O) : \
$(SRC)/intervals.h \
$(SRC)/keymap.h \
$(SRC)/syntax.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h
$(BLD)/sysdep.$(O) : \
@@ -1165,7 +1131,6 @@ $(BLD)/sysdep.$(O) : \
$(SRC)/termchar.h \
$(SRC)/termhooks.h \
$(SRC)/termopts.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -1185,7 +1150,6 @@ $(BLD)/term.$(O) : \
$(SRC)/termchar.h \
$(SRC)/termhooks.h \
$(SRC)/termopts.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -1211,7 +1175,6 @@ $(BLD)/textprop.$(O) : \
$(SRC)/composite.h \
$(SRC)/dispextern.h \
$(SRC)/intervals.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/window.h
@@ -1252,7 +1215,6 @@ $(BLD)/window.$(O) : \
$(SRC)/keymap.h \
$(SRC)/systime.h \
$(SRC)/termchar.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32term.h \
$(SRC)/window.h
@@ -1284,7 +1246,6 @@ $(BLD)/xdisp.$(O) : \
$(SRC)/systime.h \
$(SRC)/termchar.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32term.h \
$(SRC)/window.h
@@ -1307,7 +1268,6 @@ $(BLD)/xfaces.$(O): \
$(SRC)/systime.h \
$(SRC)/termchar.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32term.h \
$(SRC)/window.h
@@ -1332,7 +1292,6 @@ $(BLD)/w32fns.$(O): \
$(SRC)/keyboard.h \
$(SRC)/systime.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32heap.h \
$(SRC)/w32term.h \
@@ -1353,7 +1312,6 @@ $(BLD)/w32menu.$(O): \
$(SRC)/keymap.h \
$(SRC)/systime.h \
$(SRC)/termhooks.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32term.h \
$(SRC)/window.h
@@ -1382,7 +1340,6 @@ $(BLD)/w32term.$(O): \
$(SRC)/termchar.h \
$(SRC)/termhooks.h \
$(SRC)/termopts.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32heap.h \
$(SRC)/w32term.h \
@@ -1403,7 +1360,6 @@ $(BLD)/w32select.$(O): \
$(SRC)/frame.h \
$(SRC)/keyboard.h \
$(SRC)/systime.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32heap.h \
$(SRC)/w32term.h
@@ -1414,7 +1370,6 @@ $(BLD)/w32reg.$(O): \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
$(SRC)/systime.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32term.h
@@ -1429,23 +1384,6 @@ $(BLD)/w32xfns.$(O): \
$(SRC)/frame.h \
$(SRC)/keyboard.h \
$(SRC)/systime.h \
- $(SRC)/w32bdf.h \
- $(SRC)/w32gui.h \
- $(SRC)/w32term.h
-
-$(BLD)/w32bdf.$(O): \
- $(SRC)/w32bdf.c \
- $(CONFIG_H) \
- $(SRC)/atimer.h \
- $(SRC)/blockinput.h \
- $(SRC)/character.h \
- $(SRC)/charset.h \
- $(SRC)/dispextern.h \
- $(SRC)/fontset.h \
- $(SRC)/frame.h \
- $(SRC)/keyboard.h \
- $(SRC)/systime.h \
- $(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32term.h
diff --git a/src/w32bdf.c b/src/w32bdf.c
deleted file mode 100644
index e9a1e63569e..00000000000
--- a/src/w32bdf.c
+++ /dev/null
@@ -1,875 +0,0 @@
-/* Implementation of BDF font handling on the Microsoft W32 API.
- Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008 Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Based heavily on code by H. Miyashita for Meadow (a descendant of
- MULE for W32). */
-
-#include <windows.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "lisp.h"
-#include "character.h"
-#include "keyboard.h"
-#include "frame.h"
-#include "dispextern.h"
-#include "fontset.h"
-#include "blockinput.h"
-#include "w32gui.h"
-#include "w32term.h"
-#include "w32bdf.h"
-
-/* 10 planes */
-#define BDF_CODEPOINT_HEAP_INITIAL_SIZE (96 * 10)
-/* about 96 characters */
-#define BDF_BITMAP_HEAP_INITIAL_SIZE (64 * 96)
-
-HANDLE hbdf_cp_heap = INVALID_HANDLE_VALUE;
-HANDLE hbdf_bmp_heap = INVALID_HANDLE_VALUE;
-
-void w32_free_bdf_font(bdffont *fontp);
-bdffont *w32_init_bdf_font(char *filename);
-
-cache_bitmap cached_bitmap_slots[BDF_FONT_CACHE_SIZE];
-cache_bitmap *pcached_bitmap_latest = cached_bitmap_slots;
-
-#define FONT_CACHE_SLOT_OVER_P(p) ((p) >= cached_bitmap_slots + BDF_FONT_CACHE_SIZE)
-
-static int
-search_file_line(char *key, char *start, int len, char **val, char **next)
-{
- unsigned int linelen;
- unsigned char *p;
-
- p = memchr(start, '\n', len);
- if (!p) return -1;
- for (;(unsigned char *)start < p;start++)
- {
- if ((*start != ' ') && (*start != '\t')) break;
- }
- linelen = (char *) p - start + 1;
- *next = p + 1;
- if (strncmp(start, key, min(strlen(key), linelen)) == 0)
- {
- *val = start + strlen(key);
- return 1;
- }
-
- return 0;
-}
-
-static int
-proceed_file_line(char *key, char *start, int *len, char **val, char **next)
-{
- int flag = 0;
-
- do {
- flag = search_file_line(key, start, *len, val, next);
- *len -= (int)(*next - start);
- start = *next;
- }while(flag == 0);
-
- if (flag == -1) return 0;
- return 1;
-}
-
-static char*
-get_quoted_string(char *start, char *end)
-{
- char *p, *q, *result;
-
- p = memchr(start, '\"', end - start);
- if (!p) return NULL;
- p++;
- q = memchr(p, '\"', end - p);
- if (!q) return NULL;
-
- result = (char*) xmalloc(q - p + 1);
-
- memcpy(result, p, q - p);
- result[q - p] = '\0';
-
- return result;
-}
-
-static int
-set_bdf_font_info(bdffont *fontp)
-{
- unsigned char *start, *p, *q;
- int len, flag;
- int bbw, bbh, bbx, bby;
- int val1;
-
- len = fontp->size;
- start = fontp->font;
-
- fontp->yoffset = 0;
- fontp->relative_compose = 0;
- fontp->default_ascent = 0;
-
- fontp->registry = NULL;
- fontp->encoding = NULL;
- fontp->slant = NULL;
-/* fontp->width = NULL; */
-
- flag = proceed_file_line("FONTBOUNDINGBOX", start, &len,
- (char **)&p, (char **)&q);
- if (!flag) return 0;
- bbw = strtol(p, (char **)&start, 10);
- p = start;
- bbh = strtol(p, (char **)&start, 10);
- p = start;
- bbx = strtol(p, (char **)&start, 10);
- p = start;
- bby = strtol(p, (char **)&start, 10);
-
- fontp->llx = bbx;
- fontp->lly = bby;
- fontp->urx = bbw + bbx;
- fontp->ury = bbh + bby;
- fontp->width = bbw;
- fontp->height = bbh;
- start = q;
- flag = proceed_file_line("STARTPROPERTIES", start, &len,
- (char **)&p, (char **)&q);
- if (!flag) return 1;
-
- flag = 0;
-
- do {
- start = q;
- if (search_file_line("PIXEL_SIZE", start, len,
- (char **)&p, (char **)&q) == 1)
- {
- val1 = atoi(p);
- fontp->pixsz = val1;
- }
- else if (search_file_line("FONT_ASCENT", start, len,
- (char **)&p, (char **)&q) == 1)
- {
- val1 = atoi(p);
- fontp->ury = val1;
- }
- else if (search_file_line("FONT_DESCENT", start, len,
- (char **)&p, (char **)&q) == 1)
- {
- val1 = atoi(p);
- fontp->lly = -val1;
- }
- else if (search_file_line("_MULE_BASELINE_OFFSET", start, len,
- (char **)&p, (char **)&q) == 1)
- {
- val1 = atoi(p);
- fontp->yoffset = -val1;
- }
- else if (search_file_line("_MULE_RELATIVE_COMPOSE", start, len,
- (char **)&p, (char **)&q) == 1)
- {
- val1 = atoi(p);
- fontp->relative_compose = val1;
- }
- else if (search_file_line("_MULE_DEFAULT_ASCENT", start, len,
- (char **)&p, (char **)&q) == 1)
- {
- val1 = atoi(p);
- fontp->default_ascent = val1;
- }
- else if (search_file_line("CHARSET_REGISTRY", start, len,
- (char **)&p, (char **)&q) == 1)
- {
- fontp->registry = get_quoted_string(p, q);
- }
- else if (search_file_line("CHARSET_ENCODING", start, len,
- (char **)&p, (char **)&q) == 1)
- {
- fontp->encoding = get_quoted_string(p, q);
- }
- else if (search_file_line("SLANT", start, len,
- (char **)&p, (char **)&q) == 1)
- {
- fontp->slant = get_quoted_string(p, q);
- }
-/*
- else if (search_file_line("SETWIDTH_NAME", start, len,
- (char **)&p, (char **)&q) == 1)
- {
- fontp->width = get_quoted_string(p, q);
- }
-*/
- else
- {
- flag = search_file_line("ENDPROPERTIES", start, len,
- (char **)&p, (char **)&q);
- }
- if (flag == -1) return 0;
- len -= (q - start);
- }while(flag == 0);
- start = q;
- flag = proceed_file_line("CHARS", start, &len, (char **)&p, (char **)&q);
- if (!flag) return 0;
- fontp->nchars = atoi(p);
- fontp->seeked = q;
-
- return 1;
-}
-
-bdffont*
-w32_init_bdf_font(char *filename)
-{
- HANDLE hfile, hfilemap;
- bdffont *bdffontp;
- unsigned char *font;
- BY_HANDLE_FILE_INFORMATION fileinfo;
- int i;
-
- if (hbdf_cp_heap == INVALID_HANDLE_VALUE)
- hbdf_cp_heap = HeapCreate(0, BDF_CODEPOINT_HEAP_INITIAL_SIZE, 0);
- if (hbdf_bmp_heap == INVALID_HANDLE_VALUE)
- hbdf_bmp_heap = HeapCreate(0, BDF_BITMAP_HEAP_INITIAL_SIZE, 0);
-
- if (!hbdf_cp_heap || !hbdf_bmp_heap)
- error("Fail to create heap for BDF");
-
- hfile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (hfile == INVALID_HANDLE_VALUE) return NULL;
- if (!GetFileInformationByHandle(hfile, &fileinfo) ||
- (fileinfo.nFileSizeHigh != 0) ||
- (fileinfo.nFileSizeLow > BDF_FILE_SIZE_MAX))
- {
- CloseHandle(hfile);
- error("Fail to open BDF file");
- }
- hfilemap = CreateFileMapping(hfile, NULL, PAGE_READONLY, 0, 0, NULL);
- if (!hfilemap)
- {
- CloseHandle(hfile);
- error("Can't map font");
- }
-
- font = MapViewOfFile(hfilemap, FILE_MAP_READ, 0, 0, 0);
-
- if (!font)
- {
- CloseHandle(hfile);
- CloseHandle(hfilemap);
- error("Can't view font");
- }
-
- bdffontp = (bdffont *) xmalloc(sizeof(bdffont));
-
- for(i = 0;i < BDF_FIRST_OFFSET_TABLE;i++)
- bdffontp->chtbl[i] = NULL;
- bdffontp->size = fileinfo.nFileSizeLow;
- bdffontp->font = font;
- bdffontp->hfile = hfile;
- bdffontp->hfilemap = hfilemap;
- bdffontp->filename = (char*) xmalloc(strlen(filename) + 1);
- strcpy(bdffontp->filename, filename);
-
- if (!set_bdf_font_info(bdffontp))
- {
- w32_free_bdf_font(bdffontp);
- error("Invalid BDF font!");
- }
- return bdffontp;
-}
-
-void
-w32_free_bdf_font(bdffont *fontp)
-{
- int i, j;
- font_char *pch;
- cache_bitmap *pcb;
-
- UnmapViewOfFile(fontp->font);
- CloseHandle(fontp->hfilemap);
- CloseHandle(fontp->hfile);
-
- xfree(fontp->registry);
- xfree(fontp->encoding);
- xfree(fontp->slant);
-/* xfree(fontp->width); */
-
- xfree(fontp->filename);
- for(i = 0;i < BDF_FIRST_OFFSET_TABLE;i++)
- {
- pch = fontp->chtbl[i];
- if (pch)
- {
- for (j = 0;j < BDF_SECOND_OFFSET_TABLE;j++)
- {
- pcb = pch[j].pcbmp;
- if (pcb)
- {
- if (pcb->pbmp)
- HeapFree(hbdf_bmp_heap, 0, pcb->pbmp);
- pcb->psrc = NULL;
- }
- }
- HeapFree(hbdf_cp_heap, 0, pch);
- }
- }
- xfree(fontp);
-}
-
-static font_char*
-get_cached_font_char(bdffont *fontp, int index)
-{
- font_char *pch, *result;
-
- if (!BDF_CODEPOINT_RANGE_COVER_P(index))
- return NULL;
-
- pch = fontp->chtbl[BDF_FIRST_OFFSET(index)];
- if (!pch)
- return NULL;
-
- result = &pch[BDF_SECOND_OFFSET(index)];
-
- if (!result->offset) return NULL;
-
- return result;
-}
-
-static font_char*
-cache_char_offset(bdffont *fontp, int index, unsigned char *offset)
-{
- font_char *pch, *result;
-
- if (!BDF_CODEPOINT_RANGE_COVER_P(index))
- return NULL;
-
- pch = fontp->chtbl[BDF_FIRST_OFFSET(index)];
- if (!pch)
- {
- pch = fontp->chtbl[BDF_FIRST_OFFSET(index)] =
- (font_char*) HeapAlloc(hbdf_cp_heap,
- HEAP_ZERO_MEMORY,
- sizeof(font_char) *
- BDF_SECOND_OFFSET_TABLE);
- if (!pch) return NULL;
- /* memset(pch, 0, sizeof(font_char) * BDF_SECOND_OFFSET_TABLE); */
- }
-
- result = &pch[BDF_SECOND_OFFSET(index)];
- result->offset = offset;
-
- return result;
-}
-
-static font_char*
-seek_char(bdffont *fontp, int index)
-{
- font_char *result;
- int len, flag, font_index;
- unsigned char *start, *p, *q;
-
- if (!fontp->seeked) return NULL;
-
- start = fontp->seeked;
- len = fontp->size - (start - fontp->font);
-
- do {
- flag = proceed_file_line("ENCODING", start, &len,
- (char **)&p, (char **)&q);
- if (!flag)
- {
- fontp->seeked = NULL;
- return NULL;
- }
- font_index = atoi(p);
- result = cache_char_offset(fontp, font_index, q);
- if (!result) return NULL;
-
- start = result->offset;
- } while (font_index != index);
- fontp->seeked = start;
-
- return result;
-}
-
-static void
-clear_cached_bitmap_slots()
-{
- int i;
- cache_bitmap *p;
-
- p = pcached_bitmap_latest;
- for (i = 0;i < BDF_FONT_CLEAR_SIZE;i++)
- {
- if (p->psrc)
- {
- if (p->pbmp)
- HeapFree(hbdf_bmp_heap, 0, p->pbmp);
- p->psrc->pcbmp = NULL;
- p->psrc = NULL;
- }
- p++;
- if (FONT_CACHE_SLOT_OVER_P(p))
- p = cached_bitmap_slots;
- }
-}
-
-#define GET_HEX_VAL(x) ((isdigit(x)) ? ((x) - '0') : \
- (((x) >= 'A') && ((x) <= 'F')) ? ((x) - 'A' + 10) : \
- (((x) >= 'a') && ((x) <= 'f')) ? ((x) - 'a' + 10) : \
- (-1))
-
-int
-w32_get_bdf_glyph(bdffont *fontp, int index, int size, glyph_struct *glyph)
-{
- font_char *pch;
- unsigned char *start, *p, *q, *bitmapp;
- unsigned char val, val1, val2;
- int i, j, len, flag, consumed;
- int align, rowbytes;
-
- pch = get_cached_font_char(fontp, index);
- if (!pch)
- {
- pch = seek_char(fontp, index);
- if (!pch)
- return 0;
- }
-
- start = pch->offset;
-
- if ((size == 0) && pch->pcbmp)
- {
- glyph->metric = pch->pcbmp->metric;
- return 1;
- }
-
- len = fontp->size - (start - fontp->font);
-
- flag = proceed_file_line("DWIDTH", start, &len, (char **)&p, (char **)&q);
- if (!flag)
- return 0;
- glyph->metric.dwidth = atoi(p);
-
- start = q;
- flag = proceed_file_line("BBX", start, &len, (char **)&p, (char **)&q);
- if (!flag)
- return 0;
- glyph->metric.bbw = strtol(p, (char **)&start, 10);
- p = start;
- glyph->metric.bbh = strtol(p, (char **)&start, 10);
- p = start;
- glyph->metric.bbox = strtol(p, (char **)&start, 10);
- p = start;
- glyph->metric.bboy = strtol(p, (char **)&start, 10);
-
- if (size == 0) return 1;
-
- start = q;
- flag = proceed_file_line("BITMAP", start, &len, (char **)&p, (char **)&q);
- if (!flag)
- return 0;
-
- consumed = 0;
- flag = 0;
- p = q;
- bitmapp = glyph->bitmap;
- rowbytes = (glyph->metric.bbw + 7) / 8;
- /* DIB requires DWORD alignment. */
- align = sizeof(DWORD) - rowbytes % sizeof(DWORD);
- consumed = glyph->metric.bbh * (rowbytes + align);
- glyph->bitmap_size = consumed;
- glyph->row_byte_size = rowbytes;
- if (size < consumed) return 0;
-
- for(i = 0;i < glyph->metric.bbh;i++)
- {
- q = memchr(p, '\n', len);
- if (!q) return 0;
- for(j = 0;((q > p) && (j < rowbytes));j++)
- {
- int ival = GET_HEX_VAL(*p);
-
- if (ival == -1) return 0;
- val1 = ival;
- p++;
- ival = GET_HEX_VAL(*p);
- if (ival == -1) return 0;
- val2 = ival;
- p++;
- val = (unsigned char)((val1 << 4) | val2);
- if (val) flag = 1;
- *bitmapp++ = val;
- }
- for(j = 0;j < align;j++)
- *bitmapp++ = 0x00;
- p = q + 1;
- }
-
- /* If this glyph is white space, return -1. */
- if (flag == 0) return -1;
-
- return consumed;
-}
-
-static
-cache_bitmap*
-get_bitmap_with_cache(bdffont *fontp, int index)
-{
- int bitmap_size, bitmap_real_size;
- font_char *pch;
- cache_bitmap* pcb;
- unsigned char *pbmp;
- glyph_struct glyph;
-
- pch = get_cached_font_char(fontp, index);
- if (pch)
- {
- pcb = pch->pcbmp;
- if (pcb) return pcb;
- }
-
- bitmap_size = ((fontp->urx - fontp->llx) / 8 + 3) * (fontp->ury - fontp->lly)
- + 256;
- glyph.bitmap = (unsigned char*) alloca(sizeof(unsigned char) * bitmap_size);
-
- bitmap_real_size = w32_get_bdf_glyph(fontp, index, bitmap_size, &glyph);
-
- if (bitmap_real_size == 0)
- return NULL;
-
- pch = get_cached_font_char(fontp, index);
- if (!pch) return NULL;
-
- if (bitmap_real_size > 0)
- {
- pbmp = (unsigned char*) HeapAlloc(hbdf_bmp_heap, 0,
- bitmap_real_size);
- if (!pbmp) return NULL;
- memcpy(pbmp, glyph.bitmap, bitmap_real_size);
- }
- else
- pbmp = NULL; /* white space character */
-
- pcb = pcached_bitmap_latest;
- if (pcb->psrc)
- clear_cached_bitmap_slots();
-
- pcb->psrc = pch;
- pcb->metric = glyph.metric;
- pcb->pbmp = pbmp;
- pcb->bitmap_size = glyph.bitmap_size;
- pcb->row_byte_size = glyph.row_byte_size;
-
- pch->pcbmp = pcb;
-
- pcached_bitmap_latest++;
- if (FONT_CACHE_SLOT_OVER_P(pcached_bitmap_latest))
- pcached_bitmap_latest = cached_bitmap_slots;
-
- return pcb;
-}
-
-static HBITMAP
-create_offscreen_bitmap(HDC hdc, int width, int height, unsigned char **bitsp)
-{
- struct {
- BITMAPINFOHEADER h;
- RGBQUAD c[2];
- } info;
-
- memset(&info, 0, sizeof(info));
- info.h.biSize = sizeof(BITMAPINFOHEADER);
- info.h.biWidth = width;
- info.h.biHeight = -height;
- info.h.biPlanes = 1;
- info.h.biBitCount = 1;
- info.h.biCompression = BI_RGB;
- info.c[1].rgbRed = info.c[1].rgbGreen = info.c[1].rgbBlue = 255;
-
- return CreateDIBSection(hdc, (LPBITMAPINFO)&info,
- DIB_RGB_COLORS, (void **)bitsp, NULL, 0);
-}
-
-glyph_metric *
-w32_BDF_TextMetric(bdffont *fontp, unsigned char *text, int dim)
-{
- int index;
- cache_bitmap *pcb;
-
- if (dim == 1)
- index = *text;
- else
- index = MAKELENDSHORT(text[1], text[0]);
-
- pcb = get_bitmap_with_cache(fontp, index);
- if (!pcb)
- return NULL;
-
- return &(pcb->metric);
-}
-
-int
-w32_BDF_TextOut(bdffont *fontp, HDC hdc, int left,
- int top, unsigned char *text, int dim, int bytelen,
- int fixed_pitch_size)
-{
- int index, btop;
- unsigned char *textp;
- cache_bitmap *pcb;
- HBRUSH hFgBrush, hOrgBrush;
- HANDLE horgobj;
- UINT textalign;
- int width, height;
- HDC hCompatDC;
- int ret = 1;
- static HBITMAP hBMP = 0;
- static HDC DIBsection_hdc = 0;
- static int DIBsection_width, DIBsection_height;
- static unsigned char *bits;
-
- hCompatDC = CreateCompatibleDC(hdc);
- if (!hCompatDC)
- return 0;
-
- textalign = GetTextAlign(hdc);
-
- hFgBrush = CreateSolidBrush(GetTextColor(hdc));
- hOrgBrush = SelectObject(hdc, hFgBrush);
-
- textp = text;
-
- while(bytelen > 0)
- {
- if (dim == 1)
- {
- index = *textp++;
- bytelen--;
- }
- else
- {
- bytelen -= 2;
- if (bytelen < 0) break;
- index = MAKELENDSHORT(textp[0], textp[1]);
- textp += 2;
- }
- pcb = get_bitmap_with_cache(fontp, index);
- if (!pcb)
- {
- ret = 0;
- break;
- }
- if (pcb->pbmp)
- {
- width = pcb->metric.bbw;
- height = pcb->metric.bbh;
-
- if (!(hBMP
- && (DIBsection_hdc == hdc)
- && (DIBsection_width == width)
- && (DIBsection_height == height)))
- {
- if (hBMP) DeleteObject(hBMP);
- hBMP = create_offscreen_bitmap(hdc, width, height, &bits);
- DIBsection_hdc = hdc;
- DIBsection_width = width;
- DIBsection_height = height;
- if (!hBMP) return 0;
- }
-
- memcpy(bits, pcb->pbmp, pcb->bitmap_size);
-
- if (textalign & TA_BASELINE)
- btop = top - (pcb->metric.bbh + pcb->metric.bboy);
- else if (textalign & TA_BOTTOM)
- btop = top - pcb->metric.bbh;
- else
- btop = top;
-
- horgobj = SelectObject(hCompatDC, hBMP);
- BitBlt(hdc, left, btop, width, height, hCompatDC, 0, 0, 0xE20746);
- SelectObject(hCompatDC, horgobj);
- }
-
- if (fixed_pitch_size)
- left += fixed_pitch_size;
- else
- left += pcb->metric.dwidth;
- }
-
- DeleteDC(hCompatDC);
-
- SelectObject(hdc, hOrgBrush);
- DeleteObject(hFgBrush);
-
- return ret;
-}
-
-struct font_info *w32_load_bdf_font (struct frame *f, char *fontname,
- int size, char* filename)
-{
- struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
- struct font_info *fontp;
- XFontStruct *font;
- bdffont* bdf_font;
-
- bdf_font = w32_init_bdf_font (filename);
-
- if (!bdf_font) return NULL;
-
- font = (XFontStruct *) xmalloc (sizeof (XFontStruct));
- bzero (font, sizeof (*font));
-
- font->bdf = bdf_font;
- font->hfont = 0;
-
- /* NTEMACS_TODO: Better way of determining if a font is double byte
- or not. */
- font->double_byte_p = bdf_font->nchars > 255 ? 1 : 0;
-
- w32_cache_char_metrics (font);
-
- /* Do we need to create the table? */
- if (dpyinfo->font_table_size == 0)
- {
- dpyinfo->font_table_size = 16;
- dpyinfo->font_table
- = (struct font_info *) xmalloc (dpyinfo->font_table_size
- * sizeof (struct font_info));
- }
- /* Do we need to grow the table? */
- else if (dpyinfo->n_fonts
- >= dpyinfo->font_table_size)
- {
- dpyinfo->font_table_size *= 2;
- dpyinfo->font_table
- = (struct font_info *) xrealloc (dpyinfo->font_table,
- (dpyinfo->font_table_size
- * sizeof (struct font_info)));
- }
-
- fontp = dpyinfo->font_table + dpyinfo->n_fonts;
-
- /* Now fill in the slots of *FONTP. */
- BLOCK_INPUT;
- bzero (fontp, sizeof (*fontp));
- fontp->font = font;
- fontp->font_idx = dpyinfo->n_fonts;
- fontp->name = (char *) xmalloc (strlen (fontname) + 1);
- bcopy (fontname, fontp->name, strlen (fontname) + 1);
- fontp->full_name = fontp->name;
- /* FIXME: look at BDF spec to see if there are better ways of finding
- average_width and space_width, hopefully that don't involve working out
- the values for ourselves from the data. */
- fontp->size = fontp->average_width = fontp->space_width = FONT_WIDTH (font);
- fontp->height = FONT_HEIGHT (font);
-
- /* The slot `encoding' specifies how to map a character
- code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to
- the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, 0:0x2020..0x7F7F,
- the font code-points (0:0x20..0x7F, 1:0xA0..0xFF,
- 0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF, or
- 2:0xA020..0xFF7F). For the moment, we don't know which charset
- uses this font. So, we set informatoin in fontp->encoding[1]
- which is never used by any charset. If mapping can't be
- decided, set FONT_ENCODING_NOT_DECIDED. */
- fontp->encoding_type = FONT_ENCODING_NOT_DECIDED;
- fontp->baseline_offset = bdf_font->yoffset;
- fontp->relative_compose = bdf_font->relative_compose;
- fontp->default_ascent = bdf_font->default_ascent;
-
- /* Set global flag fonts_changed_p to non-zero if the font loaded
- has a character with a smaller width than any other character
- before, or if the font loaded has a smaller height than any
- other font loaded before. If this happens, it will make a
- glyph matrix reallocation necessary. */
- fonts_changed_p |= x_compute_min_glyph_bounds (f);
-
- UNBLOCK_INPUT;
- dpyinfo->n_fonts++;
- return fontp;
-}
-
-/* Check a file for an XLFD string describing it. */
-int w32_BDF_to_x_font (char *file, char* xstr, int len)
-{
- HANDLE hfile, hfilemap;
- BY_HANDLE_FILE_INFORMATION fileinfo;
- char *font, *start, *p, *q;
- int flag, size, retval = 0;
-
- hfile = CreateFile (file, GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (hfile == INVALID_HANDLE_VALUE) return 0;
- if (!GetFileInformationByHandle(hfile, &fileinfo) ||
- (fileinfo.nFileSizeHigh != 0) ||
- (fileinfo.nFileSizeLow > BDF_FILE_SIZE_MAX))
- {
- CloseHandle (hfile);
- return 0;
- }
- size = fileinfo.nFileSizeLow;
-
- hfilemap = CreateFileMapping (hfile, NULL, PAGE_READONLY, 0, 0, NULL);
- if (!hfilemap)
- {
- CloseHandle (hfile);
- return 0;
- }
-
- font = MapViewOfFile (hfilemap, FILE_MAP_READ, 0, 0, 0);
- if (!font)
- {
- CloseHandle (hfile);
- CloseHandle (hfilemap);
- return 0;
- }
- start = font;
-
- flag = proceed_file_line ("FONT ", start, &size, &p, &q);
- if (flag)
- {
- /* If font provides a description of itself, check it is a
- full XLFD before accepting it. */
- int count = 0;
- char *s;
-
- for (s = p; s < q; s++)
- if (*s == '\n')
- break;
- else if (*s == '-')
- count++;
- if (count == 14 && q - p - 1 <= len)
- {
- strncpy (xstr, p, q-p-1);
- xstr[q-p-1] = '\0';
- /* Files may have DOS line ends (ie still ^M on end). */
- if (iscntrl(xstr[q-p-2]))
- xstr[q-p-2] = '\0';
-
- retval = 1;
- }
- }
- UnmapViewOfFile (font);
- CloseHandle (hfile);
- CloseHandle (hfilemap);
- return retval;
-}
-
-/* arch-tag: 2e9a45de-0c54-4a0e-95c8-2d67b2b1fa32
- (do not change this comment) */
diff --git a/src/w32bdf.h b/src/w32bdf.h
deleted file mode 100644
index aa218cd06c7..00000000000
--- a/src/w32bdf.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Definitions and header for handling BDF fonts on the Microsoft W32 API.
- Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008 Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Based heavily on code by H. Miyashita for Meadow (a descendant of
- MULE for W32). */
-
-#ifndef EMACS_W32BDF_H
-#define EMACS_W32BDF_H
-
-#define BDF_FIRST_OFFSET_TABLE 0x200
-#define BDF_SECOND_OFFSET_TABLE 0x80
-#define BDF_SECOND_OFFSET(x) ((x) & 0x7f)
-#define BDF_FIRST_OFFSET(x) (((x) >> 8) | (((x) & 0x80) << 1))
-#define BDF_CODEPOINT_MAX (BDF_FIRST_OFFSET_TABLE * BDF_SECOND_OFFSET_TABLE)
-#define BDF_CODEPOINT_RANGE_COVER_P(x) (((x) >= 0) && ((x) <= BDF_CODEPOINT_MAX))
-
-#define BDF_FONT_CACHE_SIZE 3000
-#define BDF_FONT_CLEAR_SIZE 600
-
-/*
- GLYPH METRIC (# ... character's reference point)
- ^
- y | (urx, ury)
- | ^ +----------------+
- a | b| |character | <- font bounding Box
- x | b| | |
- i | h| | #(bbox, bboy) |
- s | v +----------------+
- | (llx, lly)
- | <---------------->
- | bbw
- +----------------------->
- origin x axis
- */
-
-
-
-/* Structure of glyph information of one character. */
-typedef struct
-{
- int dwidth; /* width in pixels */
- int bbw, bbh, bbox, bboy; /* bounding box in pixels */
-} glyph_metric;
-
-typedef struct
-{
- glyph_metric metric;
- int row_byte_size; /* size in bytes occupied by one row of the bitmap */
- int bitmap_size; /* size in bytes of the following slots */
- unsigned char *bitmap; /* */
-} glyph_struct;
-
-typedef struct fchar *pfont_char;
-
-typedef struct
-{
- glyph_metric metric;
- pfont_char psrc;
- int row_byte_size;
- int bitmap_size;
- unsigned char *pbmp;
-} cache_bitmap;
-
-typedef struct fchar
-{
- unsigned char *offset;
- cache_bitmap *pcbmp;
-} font_char;
-
-typedef struct
-{
- char *filename;
- HANDLE hfile;
- HANDLE hfilemap;
- unsigned char *font;
- unsigned char *seeked;
- DWORD size;
- font_char *chtbl[BDF_FIRST_OFFSET_TABLE];
- int llx, lly, urx, ury; /* Font bounding box */
-
- int yoffset;
- int relative_compose;
- int default_ascent;
-
- unsigned char *registry;
- unsigned char *encoding;
- unsigned char *slant;
-/* unsigned char *width; */
-
- int width;
- int height;
- int pixsz;
- int nchars;
-} bdffont;
-
-#define BDF_FILE_SIZE_MAX 256*1024*1024 /* 256Mb */
-#define BDF_FONT_FILE(font) (((bdffont*)(font))->filename)
-#define MAKELENDSHORT(c1, c2) (unsigned short)((c1) | ((c2) << 8))
-
-bdffont *w32_init_bdf_font (char *filename);
-void w32_free_bdf_font (bdffont *fontp);
-int w32_get_bdf_glyph (bdffont *fontp, int index, int size,
- glyph_struct *glyph);
-int w32_BDF_TextOut (bdffont *fontp, HDC hdc, int left,
- int top, unsigned char *text, int dim,
- int bytelen, int fixed_pitch_size);
-int w32_BDF_to_x_font (char *file, char* xstr, int len);
-
-#endif /* EMACS_W32BDF_H */
-
-/* arch-tag: 7499e9f2-197e-44cc-9274-373f00b51eec
- (do not change this comment) */
diff --git a/src/w32font.c b/src/w32font.c
index f7b40595054..9b261a9da38 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -234,14 +234,7 @@ w32font_close (f, font)
struct font *font;
{
struct w32font_info *w32_font = (struct w32font_info *) font;
-
- if (w32_font->compat_w32_font)
- {
- W32FontStruct *old_w32_font = w32_font->compat_w32_font;
- DeleteObject (old_w32_font->hfont);
- xfree (old_w32_font);
- w32_font->compat_w32_font = 0;
- }
+ DeleteObject (w32_font->hfont);
}
/* w32 implementation of has_char for font backend.
@@ -314,7 +307,7 @@ w32font_encode_char (font, c)
f = XFRAME (selected_frame);
dc = get_frame_dc (f);
- old_font = SelectObject (dc, w32_font->compat_w32_font->hfont);
+ old_font = SelectObject (dc, w32_font->hfont);
/* GetCharacterPlacement is used here rather than GetGlyphIndices because
it is supported on Windows NT 4 and 9x/ME. But it cannot reliably report
@@ -367,10 +360,10 @@ w32font_text_extents (font, code, nglyphs, metrics)
WORD *wcode = NULL;
SIZE size;
+ struct w32font_info *w32_font = (struct w32font_info *) font;
+
if (metrics)
{
- struct w32font_info *w32_font = (struct w32font_info *) font;
-
bzero (metrics, sizeof (struct font_metrics));
metrics->ascent = font->ascent;
metrics->descent = font->descent;
@@ -419,7 +412,7 @@ w32font_text_extents (font, code, nglyphs, metrics)
f = XFRAME (selected_frame);
dc = get_frame_dc (f);
- old_font = SelectObject (dc, FONT_COMPAT (font)->hfont);
+ old_font = SelectObject (dc, w32_font->hfont);
}
compute_metrics (dc, w32_font, *(code + i), char_metric);
}
@@ -476,7 +469,7 @@ w32font_text_extents (font, code, nglyphs, metrics)
f = XFRAME (selected_frame);
dc = get_frame_dc (f);
- old_font = SelectObject (dc, FONT_COMPAT (font)->hfont);
+ old_font = SelectObject (dc, w32_font->hfont);
}
if (GetTextExtentPoint32W (dc, wcode, nglyphs, &size))
@@ -765,8 +758,6 @@ w32font_open_internal (f, font_entity, pixel_size, font_object)
HDC dc;
HFONT hfont, old_font;
Lisp_Object val, extra;
- /* For backwards compatibility. */
- W32FontStruct *compat_w32_font;
struct w32font_info *w32_font;
struct font * font;
OUTLINETEXTMETRIC* metrics = NULL;
@@ -832,15 +823,7 @@ w32font_open_internal (f, font_entity, pixel_size, font_object)
SelectObject (dc, old_font);
release_frame_dc (f, dc);
- /* W32FontStruct - we should get rid of this, and use the w32font_info
- struct for any W32 specific fields. font->font.font can then be hfont. */
- w32_font->compat_w32_font = xmalloc (sizeof (W32FontStruct));
- compat_w32_font = w32_font->compat_w32_font;
- bzero (compat_w32_font, sizeof (W32FontStruct));
- compat_w32_font->font_type = UNICODE_FONT;
- /* Duplicate the text metrics. */
- bcopy (&w32_font->metrics, &compat_w32_font->tm, sizeof (TEXTMETRIC));
- compat_w32_font->hfont = hfont;
+ w32_font->hfont = hfont;
{
char *name;
@@ -912,11 +895,6 @@ w32font_open_internal (f, font_entity, pixel_size, font_object)
font->underline_position = -1;
}
- /* max_descent is used for underlining in w32term.c. Hopefully this
- is temporary, as we'll want to get rid of the old compatibility
- stuff later. */
- compat_w32_font->max_bounds.descent = font->descent;
-
/* For temporary compatibility with legacy code that expects the
name to be usable in x-list-fonts. Eventually we expect to change
x-list-fonts and other places that use fonts so that this can be
@@ -2070,7 +2048,7 @@ in the font selection dialog. */)
/* Initialize as much of the font details as we can from the current
default font. */
hdc = GetDC (FRAME_W32_WINDOW (f));
- oldobj = SelectObject (hdc, FONT_COMPAT (FRAME_FONT (f))->hfont);
+ oldobj = SelectObject (hdc, ((struct w32font_info *) FRAME_FONT (f))->hfont);
GetTextFace (hdc, LF_FACESIZE, lf.lfFaceName);
if (GetTextMetrics (hdc, &tm))
{
diff --git a/src/w32font.h b/src/w32font.h
index 60ac62d6e01..30b6ed34271 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -53,11 +53,9 @@ struct w32font_info
unsigned int glyph_idx;
struct w32_metric_cache **cached_metrics;
int n_cache_blocks;
- W32FontStruct *compat_w32_font;
+ HFONT hfont;
};
-#define FONT_COMPAT(f) (((struct w32font_info *) (f))->compat_w32_font)
-
#define CACHE_BLOCKSIZE 128
Lisp_Object w32font_get_cache P_ ((FRAME_PTR fe));
diff --git a/src/w32gui.h b/src/w32gui.h
index 86e6eb4e2e7..aea3582b3ef 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -21,17 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define EMACS_W32GUI_H
#include <windows.h>
-#include "w32bdf.h"
-
-/* Emulate XCharStruct. */
-typedef struct _XCharStruct
-{
- short rbearing;
- short lbearing;
- short width;
- short ascent;
- short descent;
-} XCharStruct;
/* Emulate widget_value from ../lwlib/lwlib.h, modified for Windows. */
typedef void * XtPointer;
@@ -100,30 +89,6 @@ typedef struct _widget_value
#define malloc_widget_value() ((widget_value *) local_alloc (sizeof (widget_value)))
#define free_widget_value(wv) (local_free ((wv)))
-
-enum w32_char_font_type
-{
- UNKNOWN_FONT = 0 /* FONT_TYPE_UNKNOWN */,
- ANSI_FONT,
- UNICODE_FONT,
- BDF_1D_FONT,
- BDF_2D_FONT
-};
-
-typedef struct W32FontStruct {
- enum w32_char_font_type font_type;
- TEXTMETRIC tm;
- HFONT hfont;
- bdffont *bdf;
- int double_byte_p;
- XCharStruct max_bounds;
- XCharStruct scratch;
- /* Only store info for ascii chars, if not fixed pitch. */
- XCharStruct * per_char;
-} W32FontStruct;
-
-typedef struct W32FontStruct XFontStruct;
-
/* Emulate X GC's by keeping color and font info in a structure. */
typedef struct _XGCValues
{
diff --git a/src/w32term.c b/src/w32term.c
index 770369454ed..57662051302 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -251,8 +251,6 @@ void x_set_window_size P_ ((struct frame *, int, int, int));
void x_wm_set_window_state P_ ((struct frame *, int));
void x_wm_set_icon_pixmap P_ ((struct frame *, int));
static void w32_initialize P_ ((void));
-static void x_font_min_bounds P_ ((XFontStruct *, int *, int *));
-int x_compute_min_glyph_bounds P_ ((struct frame *));
static void x_update_end P_ ((struct frame *));
static void w32_frame_up_to_date P_ ((struct frame *));
static void w32_set_terminal_modes P_ ((struct terminal *));
@@ -1239,6 +1237,7 @@ x_draw_glyph_string_foreground (s)
struct glyph_string *s;
{
int i, x;
+ struct w32font_info * w32_font;
HFONT old_font;
/* If first glyph of S has a left box line, start drawing the text
@@ -1259,8 +1258,10 @@ x_draw_glyph_string_foreground (s)
SetBkColor (s->hdc, s->gc->background);
SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT);
- if (s->font && FONT_COMPAT (s->font)->hfont)
- old_font = SelectObject (s->hdc, FONT_COMPAT (s->font)->hfont);
+ w32_font = (struct w32font_info *) s->font;
+
+ if (w32_font && w32_font->hfont)
+ old_font = SelectObject (s->hdc, w32_font->hfont);
/* Draw characters of S as rectangles if S's font could not be
loaded. */
@@ -1278,7 +1279,6 @@ x_draw_glyph_string_foreground (s)
else
{
int boff = s->font->baseline_offset;
- struct font *font = s->font;
int y;
if (s->font->vertical_centering)
@@ -1287,14 +1287,14 @@ x_draw_glyph_string_foreground (s)
y = s->ybase - boff;
if (s->for_overlaps
|| (s->background_filled_p && s->hl != DRAW_CURSOR))
- font->driver->draw (s, 0, s->nchars, x, y, 0);
+ s->font->driver->draw (s, 0, s->nchars, x, y, 0);
else
- font->driver->draw (s, 0, s->nchars, x, y, 1);
+ s->font->driver->draw (s, 0, s->nchars, x, y, 1);
if (s->face->overstrike)
- font->driver->draw (s, 0, s->nchars, x + 1, y, 0);
+ s->font->driver->draw (s, 0, s->nchars, x + 1, y, 0);
}
- if (s->font && FONT_COMPAT (s->font)->hfont)
+ if (w32_font && w32_font->hfont)
SelectObject (s->hdc, old_font);
}
@@ -1306,6 +1306,7 @@ x_draw_composite_glyph_string_foreground (s)
{
int i, j, x;
HFONT old_font;
+ struct w32font_info * w32_font;
/* If first glyph of S has a left box line, start drawing the text
of S to the right of that box line. */
@@ -1325,8 +1326,10 @@ x_draw_composite_glyph_string_foreground (s)
SetBkMode (s->hdc, TRANSPARENT);
SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT);
- if (s->font && FONT_COMPAT (s->font)->hfont)
- old_font = SelectObject (s->hdc, FONT_COMPAT (s->font)->hfont);
+ w32_font = (struct w32font_info *) s->font;
+
+ if (w32_font && w32_font->hfont)
+ old_font = SelectObject (s->hdc, w32_font->hfont);
/* Draw a rectangle for the composition if the font for the very
first character of the composition could not be loaded. */
@@ -1392,7 +1395,7 @@ x_draw_composite_glyph_string_foreground (s)
}
}
- if (s->font && FONT_COMPAT (s->font)->hfont)
+ if (w32_font && w32_font->hfont)
SelectObject (s->hdc, old_font);
}
@@ -2342,7 +2345,7 @@ x_draw_glyph_string (s)
/* Draw strike-through. */
if (s->face->strike_through_p
- && !FONT_COMPAT (s->font)->tm.tmStruckOut)
+ && !((struct w32font_info *) s->font)->metrics.tmStruckOut)
{
unsigned long h = 1;
unsigned long dy = (s->height - h) / 2;
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index bd201739f51..494abef74db 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -166,7 +166,7 @@ uniscribe_otf_capability (font)
f = XFRAME (selected_frame);
context = get_frame_dc (f);
- old_font = SelectObject (context, FONT_COMPAT (font)->hfont);
+ old_font = SelectObject (context, ((struct w32font_info *) font)->hfont);
features = otf_features (context, "GSUB");
XSETCAR (capability, features);
@@ -259,7 +259,7 @@ uniscribe_shape (lgstring)
f = XFRAME (selected_frame);
context = get_frame_dc (f);
- old_font = SelectObject (context, FONT_COMPAT (font)->hfont);
+ old_font = SelectObject (context, uniscribe_font->w32_font.hfont);
glyphs = alloca (max_glyphs * sizeof (WORD));
clusters = alloca (nchars * sizeof (WORD));
@@ -424,7 +424,7 @@ uniscribe_encode_char (font, c)
/* Use selected frame until API is updated to pass the frame. */
f = XFRAME (selected_frame);
context = get_frame_dc (f);
- old_font = SelectObject (context, FONT_COMPAT (font)->hfont);
+ old_font = SelectObject (context, ((struct w32font_info *) font)->hfont);
retval = GetGlyphIndicesW (context, chars, 1, indices,
GGI_MARK_NONEXISTING_GLYPHS);