aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2008-06-26 10:48:28 +0000
committerJason Rumney2008-06-26 10:48:28 +0000
commit1b5defe6580487f499c0af4a598ee968c5cae062 (patch)
treefda3244a1c6bcaac61eda98d5429d2d6599ddb57 /src
parentdc018447584eecaf2de92eef2ec3c9f60c5f818f (diff)
downloademacs-1b5defe6580487f499c0af4a598ee968c5cae062.tar.gz
emacs-1b5defe6580487f499c0af4a598ee968c5cae062.zip
* 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.
Diffstat (limited to 'src')
-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 @@
12008-06-26 Jason Rumney <jasonr@gnu.org>
2
3 * w32bdf.c, w32bdf.h: Remove obsolete files.
4
5 * makefile.w32-in: Remove refs to w32bdf.h and w32bdf.c.
6
7 * w32gui.h: Don't include w32bdf.h.
8 (XCharStruct, enum w32_char_font_type, W32FontStruct):
9 Remove obsolete font support.
10
11 * w32font.h (struct w32font_info): Remove compat_w32_font.
12 Add hfont member.
13 (FONT_COMPAT): Remove obsolete macro.
14
15 * w32font.c (w32font_close): Remove compat code. Delete hfont member.
16 (w32font_encode_char, w32font_text_extents): Use new hfont member.
17 (w32font_open_internal): Remove compat code. Set new hfont member.
18 (Fx_select_font): Use new hfont member.
19
20 * w32uniscribe.c (uniscribe_otf_capability, uniscribe_shape):
21 (uniscribe_encode_char): Use new hfont member.
22
23 * w32term.c (x_draw_glyph_string_foreground):
24 (x_draw_composite_glyph_string_foreground): Use new hfont member.
25 (x_draw_glyph_string): Use metrics in w32font_info.
26
12008-06-26 Kenichi Handa <handa@m17n.org> 272008-06-26 Kenichi Handa <handa@m17n.org>
2 28
3 * xdisp.c (handle_auto_composed_prop): Fix for the terminal case. 29 * 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) \
134 $(BLD)/w32select.$(O) \ 134 $(BLD)/w32select.$(O) \
135 $(BLD)/w32menu.$(O) \ 135 $(BLD)/w32menu.$(O) \
136 $(BLD)/w32reg.$(O) 136 $(BLD)/w32reg.$(O)
137# $(BLD)/w32bdf.$(O)
138 137
139FONTOBJ = $(BLD)/w32font.$(O) $(BLD)/w32uniscribe.$(O) 138FONTOBJ = $(BLD)/w32font.$(O) $(BLD)/w32uniscribe.$(O)
140 139
@@ -291,7 +290,6 @@ $(BLD)/abbrev.$(O) : \
291 $(SRC)/commands.h \ 290 $(SRC)/commands.h \
292 $(SRC)/dispextern.h \ 291 $(SRC)/dispextern.h \
293 $(SRC)/syntax.h \ 292 $(SRC)/syntax.h \
294 $(SRC)/w32bdf.h \
295 $(SRC)/w32gui.h \ 293 $(SRC)/w32gui.h \
296 $(SRC)/window.h 294 $(SRC)/window.h
297 295
@@ -310,7 +308,6 @@ $(BLD)/alloc.$(O) : \
310 $(SRC)/process.h \ 308 $(SRC)/process.h \
311 $(SRC)/puresize.h \ 309 $(SRC)/puresize.h \
312 $(SRC)/syssignal.h \ 310 $(SRC)/syssignal.h \
313 $(SRC)/w32bdf.h \
314 $(SRC)/w32gui.h \ 311 $(SRC)/w32gui.h \
315 $(SRC)/window.h 312 $(SRC)/window.h
316 313
@@ -338,7 +335,6 @@ $(BLD)/buffer.$(O) : \
338 $(SRC)/keyboard.h \ 335 $(SRC)/keyboard.h \
339 $(SRC)/keymap.h \ 336 $(SRC)/keymap.h \
340 $(SRC)/region-cache.h \ 337 $(SRC)/region-cache.h \
341 $(SRC)/w32bdf.h \
342 $(SRC)/w32gui.h \ 338 $(SRC)/w32gui.h \
343 $(SRC)/window.h 339 $(SRC)/window.h
344 340
@@ -358,7 +354,6 @@ $(BLD)/callint.$(O) : \
358 $(SRC)/dispextern.h \ 354 $(SRC)/dispextern.h \
359 $(SRC)/keyboard.h \ 355 $(SRC)/keyboard.h \
360 $(SRC)/keymap.h \ 356 $(SRC)/keymap.h \
361 $(SRC)/w32bdf.h \
362 $(SRC)/w32gui.h \ 357 $(SRC)/w32gui.h \
363 $(SRC)/window.h 358 $(SRC)/window.h
364 359
@@ -461,7 +456,6 @@ $(BLD)/cmds.$(O) : \
461 $(SRC)/keyboard.h \ 456 $(SRC)/keyboard.h \
462 $(SRC)/keymap.h \ 457 $(SRC)/keymap.h \
463 $(SRC)/syntax.h \ 458 $(SRC)/syntax.h \
464 $(SRC)/w32bdf.h \
465 $(SRC)/w32gui.h \ 459 $(SRC)/w32gui.h \
466 $(SRC)/window.h 460 $(SRC)/window.h
467 461
@@ -478,7 +472,6 @@ $(BLD)/coding.$(O) : \
478 $(SRC)/intervals.h \ 472 $(SRC)/intervals.h \
479 $(SRC)/frame.h \ 473 $(SRC)/frame.h \
480 $(SRC)/termhooks.h \ 474 $(SRC)/termhooks.h \
481 $(SRC)/w32bdf.h \
482 $(SRC)/w32gui.h \ 475 $(SRC)/w32gui.h \
483 $(SRC)/window.h 476 $(SRC)/window.h
484 477
@@ -491,7 +484,6 @@ $(BLD)/composite.$(O) : \
491 $(SRC)/composite.h \ 484 $(SRC)/composite.h \
492 $(SRC)/dispextern.h \ 485 $(SRC)/dispextern.h \
493 $(SRC)/intervals.h \ 486 $(SRC)/intervals.h \
494 $(SRC)/w32bdf.h \
495 $(SRC)/w32gui.h 487 $(SRC)/w32gui.h
496 488
497$(BLD)/data.$(O) : \ 489$(BLD)/data.$(O) : \
@@ -544,7 +536,6 @@ $(BLD)/dispnew.$(O) : \
544 $(SRC)/termchar.h \ 536 $(SRC)/termchar.h \
545 $(SRC)/termhooks.h \ 537 $(SRC)/termhooks.h \
546 $(SRC)/termopts.h \ 538 $(SRC)/termopts.h \
547 $(SRC)/w32bdf.h \
548 $(SRC)/w32gui.h \ 539 $(SRC)/w32gui.h \
549 $(SRC)/w32term.h \ 540 $(SRC)/w32term.h \
550 $(SRC)/window.h 541 $(SRC)/window.h
@@ -579,7 +570,6 @@ $(BLD)/editfns.$(O) : \
579 $(SRC)/frame.h \ 570 $(SRC)/frame.h \
580 $(SRC)/intervals.h \ 571 $(SRC)/intervals.h \
581 $(SRC)/systime.h \ 572 $(SRC)/systime.h \
582 $(SRC)/w32bdf.h \
583 $(SRC)/w32gui.h \ 573 $(SRC)/w32gui.h \
584 $(SRC)/window.h 574 $(SRC)/window.h
585 575
@@ -602,7 +592,6 @@ $(BLD)/emacs.$(O) : \
602 $(SRC)/systime.h \ 592 $(SRC)/systime.h \
603 $(SRC)/systty.h \ 593 $(SRC)/systty.h \
604 $(SRC)/termhooks.h \ 594 $(SRC)/termhooks.h \
605 $(SRC)/w32bdf.h \
606 $(SRC)/w32gui.h \ 595 $(SRC)/w32gui.h \
607 $(SRC)/w32heap.h \ 596 $(SRC)/w32heap.h \
608 $(SRC)/window.h 597 $(SRC)/window.h
@@ -616,7 +605,6 @@ $(BLD)/eval.$(O) : \
616 $(SRC)/dispextern.h \ 605 $(SRC)/dispextern.h \
617 $(SRC)/keyboard.h \ 606 $(SRC)/keyboard.h \
618 $(SRC)/systime.h \ 607 $(SRC)/systime.h \
619 $(SRC)/w32bdf.h \
620 $(SRC)/w32gui.h 608 $(SRC)/w32gui.h
621 609
622$(BLD)/fileio.$(O) : \ 610$(BLD)/fileio.$(O) : \
@@ -635,7 +623,6 @@ $(BLD)/fileio.$(O) : \
635 $(SRC)/dispextern.h \ 623 $(SRC)/dispextern.h \
636 $(SRC)/intervals.h \ 624 $(SRC)/intervals.h \
637 $(SRC)/systime.h \ 625 $(SRC)/systime.h \
638 $(SRC)/w32bdf.h \
639 $(SRC)/w32gui.h \ 626 $(SRC)/w32gui.h \
640 $(SRC)/window.h 627 $(SRC)/window.h
641 628
@@ -687,7 +674,6 @@ $(BLD)/fns.$(O) : \
687 $(SRC)/md5.h \ 674 $(SRC)/md5.h \
688 $(SRC)/systime.h \ 675 $(SRC)/systime.h \
689 $(SRC)/termhooks.h \ 676 $(SRC)/termhooks.h \
690 $(SRC)/w32bdf.h \
691 $(SRC)/w32gui.h \ 677 $(SRC)/w32gui.h \
692 $(SRC)/window.h 678 $(SRC)/window.h
693 679
@@ -715,7 +701,6 @@ $(BLD)/fontset.$(O) : \
715 $(SRC)/frame.h \ 701 $(SRC)/frame.h \
716 $(SRC)/keyboard.h \ 702 $(SRC)/keyboard.h \
717 $(SRC)/termhooks.h \ 703 $(SRC)/termhooks.h \
718 $(SRC)/w32bdf.h \
719 $(SRC)/w32gui.h \ 704 $(SRC)/w32gui.h \
720 $(SRC)/window.h 705 $(SRC)/window.h
721 706
@@ -735,7 +720,6 @@ $(BLD)/frame.$(O) : \
735 $(SRC)/systime.h \ 720 $(SRC)/systime.h \
736 $(SRC)/termchar.h \ 721 $(SRC)/termchar.h \
737 $(SRC)/termhooks.h \ 722 $(SRC)/termhooks.h \
738 $(SRC)/w32bdf.h \
739 $(SRC)/w32gui.h \ 723 $(SRC)/w32gui.h \
740 $(SRC)/w32term.h \ 724 $(SRC)/w32term.h \
741 $(SRC)/window.h 725 $(SRC)/window.h
@@ -749,7 +733,6 @@ $(BLD)/fringe.$(O) : \
749 $(SRC)/dispextern.h \ 733 $(SRC)/dispextern.h \
750 $(SRC)/frame.h \ 734 $(SRC)/frame.h \
751 $(SRC)/systime.h \ 735 $(SRC)/systime.h \
752 $(SRC)/w32bdf.h \
753 $(SRC)/w32gui.h \ 736 $(SRC)/w32gui.h \
754 $(SRC)/window.h 737 $(SRC)/window.h
755 738
@@ -769,7 +752,6 @@ $(BLD)/image.$(O): \
769 $(SRC)/frame.h \ 752 $(SRC)/frame.h \
770 $(SRC)/systime.h \ 753 $(SRC)/systime.h \
771 $(SRC)/termhooks.h \ 754 $(SRC)/termhooks.h \
772 $(SRC)/w32bdf.h \
773 $(SRC)/w32gui.h \ 755 $(SRC)/w32gui.h \
774 $(SRC)/w32heap.h \ 756 $(SRC)/w32heap.h \
775 $(SRC)/w32term.h \ 757 $(SRC)/w32term.h \
@@ -792,7 +774,6 @@ $(BLD)/indent.$(O) : \
792 $(SRC)/region-cache.h \ 774 $(SRC)/region-cache.h \
793 $(SRC)/termchar.h \ 775 $(SRC)/termchar.h \
794 $(SRC)/termopts.h \ 776 $(SRC)/termopts.h \
795 $(SRC)/w32bdf.h \
796 $(SRC)/w32gui.h \ 777 $(SRC)/w32gui.h \
797 $(SRC)/window.h 778 $(SRC)/window.h
798 779
@@ -809,7 +790,6 @@ $(BLD)/insdel.$(O) : \
809 $(SRC)/intervals.h \ 790 $(SRC)/intervals.h \
810 $(SRC)/region-cache.h \ 791 $(SRC)/region-cache.h \
811 $(SRC)/systime.h \ 792 $(SRC)/systime.h \
812 $(SRC)/w32bdf.h \
813 $(SRC)/w32gui.h \ 793 $(SRC)/w32gui.h \
814 $(SRC)/window.h 794 $(SRC)/window.h
815 795
@@ -823,7 +803,6 @@ $(BLD)/intervals.$(O) : \
823 $(SRC)/keyboard.h \ 803 $(SRC)/keyboard.h \
824 $(SRC)/keymap.h \ 804 $(SRC)/keymap.h \
825 $(SRC)/puresize.h \ 805 $(SRC)/puresize.h \
826 $(SRC)/w32bdf.h \
827 $(SRC)/w32gui.h 806 $(SRC)/w32gui.h
828 807
829$(BLD)/keyboard.$(O) : \ 808$(BLD)/keyboard.$(O) : \
@@ -853,7 +832,6 @@ $(BLD)/keyboard.$(O) : \
853 $(SRC)/termchar.h \ 832 $(SRC)/termchar.h \
854 $(SRC)/termhooks.h \ 833 $(SRC)/termhooks.h \
855 $(SRC)/termopts.h \ 834 $(SRC)/termopts.h \
856 $(SRC)/w32bdf.h \
857 $(SRC)/w32gui.h \ 835 $(SRC)/w32gui.h \
858 $(SRC)/w32term.h \ 836 $(SRC)/w32term.h \
859 $(SRC)/window.h 837 $(SRC)/window.h
@@ -875,7 +853,6 @@ $(BLD)/keymap.$(O) : \
875 $(SRC)/puresize.h \ 853 $(SRC)/puresize.h \
876 $(SRC)/systime.h \ 854 $(SRC)/systime.h \
877 $(SRC)/termhooks.h \ 855 $(SRC)/termhooks.h \
878 $(SRC)/w32bdf.h \
879 $(SRC)/w32gui.h 856 $(SRC)/w32gui.h
880 857
881$(BLD)/lastfile.$(O) : \ 858$(BLD)/lastfile.$(O) : \
@@ -899,7 +876,6 @@ $(BLD)/lread.$(O) : \
899 $(SRC)/intervals.h \ 876 $(SRC)/intervals.h \
900 $(SRC)/keyboard.h \ 877 $(SRC)/keyboard.h \
901 $(SRC)/termhooks.h \ 878 $(SRC)/termhooks.h \
902 $(SRC)/w32bdf.h \
903 $(SRC)/w32gui.h 879 $(SRC)/w32gui.h
904 880
905$(BLD)/macros.$(O) : \ 881$(BLD)/macros.$(O) : \
@@ -910,7 +886,6 @@ $(BLD)/macros.$(O) : \
910 $(SRC)/dispextern.h \ 886 $(SRC)/dispextern.h \
911 $(SRC)/keyboard.h \ 887 $(SRC)/keyboard.h \
912 $(SRC)/macros.h \ 888 $(SRC)/macros.h \
913 $(SRC)/w32bdf.h \
914 $(SRC)/w32gui.h \ 889 $(SRC)/w32gui.h \
915 $(SRC)/window.h 890 $(SRC)/window.h
916 891
@@ -952,7 +927,6 @@ $(BLD)/minibuf.$(O) : \
952 $(SRC)/keymap.h \ 927 $(SRC)/keymap.h \
953 $(SRC)/syntax.h \ 928 $(SRC)/syntax.h \
954 $(SRC)/termhooks.h \ 929 $(SRC)/termhooks.h \
955 $(SRC)/w32bdf.h \
956 $(SRC)/w32gui.h \ 930 $(SRC)/w32gui.h \
957 $(SRC)/window.h 931 $(SRC)/window.h
958 932
@@ -979,7 +953,6 @@ $(BLD)/w32inevt.$(O) : \
979 $(SRC)/keyboard.h \ 953 $(SRC)/keyboard.h \
980 $(SRC)/systime.h \ 954 $(SRC)/systime.h \
981 $(SRC)/termhooks.h \ 955 $(SRC)/termhooks.h \
982 $(SRC)/w32bdf.h \
983 $(SRC)/w32gui.h \ 956 $(SRC)/w32gui.h \
984 $(SRC)/w32heap.h \ 957 $(SRC)/w32heap.h \
985 $(SRC)/w32term.h 958 $(SRC)/w32term.h
@@ -995,7 +968,6 @@ $(BLD)/w32proc.$(O) : \
995 $(SRC)/systime.h \ 968 $(SRC)/systime.h \
996 $(SRC)/syswait.h \ 969 $(SRC)/syswait.h \
997 $(SRC)/w32.h \ 970 $(SRC)/w32.h \
998 $(SRC)/w32bdf.h \
999 $(SRC)/w32gui.h \ 971 $(SRC)/w32gui.h \
1000 $(SRC)/w32heap.h \ 972 $(SRC)/w32heap.h \
1001 $(SRC)/w32term.h 973 $(SRC)/w32term.h
@@ -1011,7 +983,6 @@ $(BLD)/w32console.$(O) : \
1011 $(SRC)/disptab.h \ 983 $(SRC)/disptab.h \
1012 $(SRC)/frame.h \ 984 $(SRC)/frame.h \
1013 $(SRC)/termhooks.h \ 985 $(SRC)/termhooks.h \
1014 $(SRC)/w32bdf.h \
1015 $(SRC)/w32gui.h \ 986 $(SRC)/w32gui.h \
1016 $(SRC)/w32inevt.h 987 $(SRC)/w32inevt.h
1017 988
@@ -1028,7 +999,6 @@ $(BLD)/print.$(O) : \
1028 $(SRC)/keyboard.h \ 999 $(SRC)/keyboard.h \
1029 $(SRC)/process.h \ 1000 $(SRC)/process.h \
1030 $(SRC)/termchar.h \ 1001 $(SRC)/termchar.h \
1031 $(SRC)/w32bdf.h \
1032 $(SRC)/w32gui.h \ 1002 $(SRC)/w32gui.h \
1033 $(SRC)/window.h 1003 $(SRC)/window.h
1034 1004
@@ -1057,7 +1027,6 @@ $(BLD)/process.$(O) : \
1057 $(SRC)/syswait.h \ 1027 $(SRC)/syswait.h \
1058 $(SRC)/termhooks.h \ 1028 $(SRC)/termhooks.h \
1059 $(SRC)/termopts.h \ 1029 $(SRC)/termopts.h \
1060 $(SRC)/w32bdf.h \
1061 $(SRC)/w32gui.h \ 1030 $(SRC)/w32gui.h \
1062 $(SRC)/window.h 1031 $(SRC)/window.h
1063 1032
@@ -1091,7 +1060,6 @@ $(BLD)/scroll.$(O) : \
1091 $(SRC)/keyboard.h \ 1060 $(SRC)/keyboard.h \
1092 $(SRC)/termchar.h \ 1061 $(SRC)/termchar.h \
1093 $(SRC)/termhooks.h \ 1062 $(SRC)/termhooks.h \
1094 $(SRC)/w32bdf.h \
1095 $(SRC)/w32gui.h \ 1063 $(SRC)/w32gui.h \
1096 $(SRC)/window.h 1064 $(SRC)/window.h
1097 1065
@@ -1112,7 +1080,6 @@ $(BLD)/search.$(O) : \
1112 $(SRC)/region-cache.h \ 1080 $(SRC)/region-cache.h \
1113 $(SRC)/syntax.h \ 1081 $(SRC)/syntax.h \
1114 $(SRC)/systime.h \ 1082 $(SRC)/systime.h \
1115 $(SRC)/w32bdf.h \
1116 $(SRC)/w32gui.h 1083 $(SRC)/w32gui.h
1117 1084
1118$(BLD)/sound.$(O) : \ 1085$(BLD)/sound.$(O) : \
@@ -1139,7 +1106,6 @@ $(BLD)/syntax.$(O) : \
1139 $(SRC)/intervals.h \ 1106 $(SRC)/intervals.h \
1140 $(SRC)/keymap.h \ 1107 $(SRC)/keymap.h \
1141 $(SRC)/syntax.h \ 1108 $(SRC)/syntax.h \
1142 $(SRC)/w32bdf.h \
1143 $(SRC)/w32gui.h 1109 $(SRC)/w32gui.h
1144 1110
1145$(BLD)/sysdep.$(O) : \ 1111$(BLD)/sysdep.$(O) : \
@@ -1165,7 +1131,6 @@ $(BLD)/sysdep.$(O) : \
1165 $(SRC)/termchar.h \ 1131 $(SRC)/termchar.h \
1166 $(SRC)/termhooks.h \ 1132 $(SRC)/termhooks.h \
1167 $(SRC)/termopts.h \ 1133 $(SRC)/termopts.h \
1168 $(SRC)/w32bdf.h \
1169 $(SRC)/w32gui.h \ 1134 $(SRC)/w32gui.h \
1170 $(SRC)/window.h 1135 $(SRC)/window.h
1171 1136
@@ -1185,7 +1150,6 @@ $(BLD)/term.$(O) : \
1185 $(SRC)/termchar.h \ 1150 $(SRC)/termchar.h \
1186 $(SRC)/termhooks.h \ 1151 $(SRC)/termhooks.h \
1187 $(SRC)/termopts.h \ 1152 $(SRC)/termopts.h \
1188 $(SRC)/w32bdf.h \
1189 $(SRC)/w32gui.h \ 1153 $(SRC)/w32gui.h \
1190 $(SRC)/window.h 1154 $(SRC)/window.h
1191 1155
@@ -1211,7 +1175,6 @@ $(BLD)/textprop.$(O) : \
1211 $(SRC)/composite.h \ 1175 $(SRC)/composite.h \
1212 $(SRC)/dispextern.h \ 1176 $(SRC)/dispextern.h \
1213 $(SRC)/intervals.h \ 1177 $(SRC)/intervals.h \
1214 $(SRC)/w32bdf.h \
1215 $(SRC)/w32gui.h \ 1178 $(SRC)/w32gui.h \
1216 $(SRC)/window.h 1179 $(SRC)/window.h
1217 1180
@@ -1252,7 +1215,6 @@ $(BLD)/window.$(O) : \
1252 $(SRC)/keymap.h \ 1215 $(SRC)/keymap.h \
1253 $(SRC)/systime.h \ 1216 $(SRC)/systime.h \
1254 $(SRC)/termchar.h \ 1217 $(SRC)/termchar.h \
1255 $(SRC)/w32bdf.h \
1256 $(SRC)/w32gui.h \ 1218 $(SRC)/w32gui.h \
1257 $(SRC)/w32term.h \ 1219 $(SRC)/w32term.h \
1258 $(SRC)/window.h 1220 $(SRC)/window.h
@@ -1284,7 +1246,6 @@ $(BLD)/xdisp.$(O) : \
1284 $(SRC)/systime.h \ 1246 $(SRC)/systime.h \
1285 $(SRC)/termchar.h \ 1247 $(SRC)/termchar.h \
1286 $(SRC)/termhooks.h \ 1248 $(SRC)/termhooks.h \
1287 $(SRC)/w32bdf.h \
1288 $(SRC)/w32gui.h \ 1249 $(SRC)/w32gui.h \
1289 $(SRC)/w32term.h \ 1250 $(SRC)/w32term.h \
1290 $(SRC)/window.h 1251 $(SRC)/window.h
@@ -1307,7 +1268,6 @@ $(BLD)/xfaces.$(O): \
1307 $(SRC)/systime.h \ 1268 $(SRC)/systime.h \
1308 $(SRC)/termchar.h \ 1269 $(SRC)/termchar.h \
1309 $(SRC)/termhooks.h \ 1270 $(SRC)/termhooks.h \
1310 $(SRC)/w32bdf.h \
1311 $(SRC)/w32gui.h \ 1271 $(SRC)/w32gui.h \
1312 $(SRC)/w32term.h \ 1272 $(SRC)/w32term.h \
1313 $(SRC)/window.h 1273 $(SRC)/window.h
@@ -1332,7 +1292,6 @@ $(BLD)/w32fns.$(O): \
1332 $(SRC)/keyboard.h \ 1292 $(SRC)/keyboard.h \
1333 $(SRC)/systime.h \ 1293 $(SRC)/systime.h \
1334 $(SRC)/termhooks.h \ 1294 $(SRC)/termhooks.h \
1335 $(SRC)/w32bdf.h \
1336 $(SRC)/w32gui.h \ 1295 $(SRC)/w32gui.h \
1337 $(SRC)/w32heap.h \ 1296 $(SRC)/w32heap.h \
1338 $(SRC)/w32term.h \ 1297 $(SRC)/w32term.h \
@@ -1353,7 +1312,6 @@ $(BLD)/w32menu.$(O): \
1353 $(SRC)/keymap.h \ 1312 $(SRC)/keymap.h \
1354 $(SRC)/systime.h \ 1313 $(SRC)/systime.h \
1355 $(SRC)/termhooks.h \ 1314 $(SRC)/termhooks.h \
1356 $(SRC)/w32bdf.h \
1357 $(SRC)/w32gui.h \ 1315 $(SRC)/w32gui.h \
1358 $(SRC)/w32term.h \ 1316 $(SRC)/w32term.h \
1359 $(SRC)/window.h 1317 $(SRC)/window.h
@@ -1382,7 +1340,6 @@ $(BLD)/w32term.$(O): \
1382 $(SRC)/termchar.h \ 1340 $(SRC)/termchar.h \
1383 $(SRC)/termhooks.h \ 1341 $(SRC)/termhooks.h \
1384 $(SRC)/termopts.h \ 1342 $(SRC)/termopts.h \
1385 $(SRC)/w32bdf.h \
1386 $(SRC)/w32gui.h \ 1343 $(SRC)/w32gui.h \
1387 $(SRC)/w32heap.h \ 1344 $(SRC)/w32heap.h \
1388 $(SRC)/w32term.h \ 1345 $(SRC)/w32term.h \
@@ -1403,7 +1360,6 @@ $(BLD)/w32select.$(O): \
1403 $(SRC)/frame.h \ 1360 $(SRC)/frame.h \
1404 $(SRC)/keyboard.h \ 1361 $(SRC)/keyboard.h \
1405 $(SRC)/systime.h \ 1362 $(SRC)/systime.h \
1406 $(SRC)/w32bdf.h \
1407 $(SRC)/w32gui.h \ 1363 $(SRC)/w32gui.h \
1408 $(SRC)/w32heap.h \ 1364 $(SRC)/w32heap.h \
1409 $(SRC)/w32term.h 1365 $(SRC)/w32term.h
@@ -1414,7 +1370,6 @@ $(BLD)/w32reg.$(O): \
1414 $(SRC)/atimer.h \ 1370 $(SRC)/atimer.h \
1415 $(SRC)/blockinput.h \ 1371 $(SRC)/blockinput.h \
1416 $(SRC)/systime.h \ 1372 $(SRC)/systime.h \
1417 $(SRC)/w32bdf.h \
1418 $(SRC)/w32gui.h \ 1373 $(SRC)/w32gui.h \
1419 $(SRC)/w32term.h 1374 $(SRC)/w32term.h
1420 1375
@@ -1429,23 +1384,6 @@ $(BLD)/w32xfns.$(O): \
1429 $(SRC)/frame.h \ 1384 $(SRC)/frame.h \
1430 $(SRC)/keyboard.h \ 1385 $(SRC)/keyboard.h \
1431 $(SRC)/systime.h \ 1386 $(SRC)/systime.h \
1432 $(SRC)/w32bdf.h \
1433 $(SRC)/w32gui.h \
1434 $(SRC)/w32term.h
1435
1436$(BLD)/w32bdf.$(O): \
1437 $(SRC)/w32bdf.c \
1438 $(CONFIG_H) \
1439 $(SRC)/atimer.h \
1440 $(SRC)/blockinput.h \
1441 $(SRC)/character.h \
1442 $(SRC)/charset.h \
1443 $(SRC)/dispextern.h \
1444 $(SRC)/fontset.h \
1445 $(SRC)/frame.h \
1446 $(SRC)/keyboard.h \
1447 $(SRC)/systime.h \
1448 $(SRC)/w32bdf.h \
1449 $(SRC)/w32gui.h \ 1387 $(SRC)/w32gui.h \
1450 $(SRC)/w32term.h 1388 $(SRC)/w32term.h
1451 1389
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 @@
1/* Implementation of BDF font handling on the Microsoft W32 API.
2 Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005,
3 2006, 2007, 2008 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20/* Based heavily on code by H. Miyashita for Meadow (a descendant of
21 MULE for W32). */
22
23#include <windows.h>
24
25#ifdef HAVE_CONFIG_H
26#include <config.h>
27#endif
28
29#include "lisp.h"
30#include "character.h"
31#include "keyboard.h"
32#include "frame.h"
33#include "dispextern.h"
34#include "fontset.h"
35#include "blockinput.h"
36#include "w32gui.h"
37#include "w32term.h"
38#include "w32bdf.h"
39
40/* 10 planes */
41#define BDF_CODEPOINT_HEAP_INITIAL_SIZE (96 * 10)
42/* about 96 characters */
43#define BDF_BITMAP_HEAP_INITIAL_SIZE (64 * 96)
44
45HANDLE hbdf_cp_heap = INVALID_HANDLE_VALUE;
46HANDLE hbdf_bmp_heap = INVALID_HANDLE_VALUE;
47
48void w32_free_bdf_font(bdffont *fontp);
49bdffont *w32_init_bdf_font(char *filename);
50
51cache_bitmap cached_bitmap_slots[BDF_FONT_CACHE_SIZE];
52cache_bitmap *pcached_bitmap_latest = cached_bitmap_slots;
53
54#define FONT_CACHE_SLOT_OVER_P(p) ((p) >= cached_bitmap_slots + BDF_FONT_CACHE_SIZE)
55
56static int
57search_file_line(char *key, char *start, int len, char **val, char **next)
58{
59 unsigned int linelen;
60 unsigned char *p;
61
62 p = memchr(start, '\n', len);
63 if (!p) return -1;
64 for (;(unsigned char *)start < p;start++)
65 {
66 if ((*start != ' ') && (*start != '\t')) break;
67 }
68 linelen = (char *) p - start + 1;
69 *next = p + 1;
70 if (strncmp(start, key, min(strlen(key), linelen)) == 0)
71 {
72 *val = start + strlen(key);
73 return 1;
74 }
75
76 return 0;
77}
78
79static int
80proceed_file_line(char *key, char *start, int *len, char **val, char **next)
81{
82 int flag = 0;
83
84 do {
85 flag = search_file_line(key, start, *len, val, next);
86 *len -= (int)(*next - start);
87 start = *next;
88 }while(flag == 0);
89
90 if (flag == -1) return 0;
91 return 1;
92}
93
94static char*
95get_quoted_string(char *start, char *end)
96{
97 char *p, *q, *result;
98
99 p = memchr(start, '\"', end - start);
100 if (!p) return NULL;
101 p++;
102 q = memchr(p, '\"', end - p);
103 if (!q) return NULL;
104
105 result = (char*) xmalloc(q - p + 1);
106
107 memcpy(result, p, q - p);
108 result[q - p] = '\0';
109
110 return result;
111}
112
113static int
114set_bdf_font_info(bdffont *fontp)
115{
116 unsigned char *start, *p, *q;
117 int len, flag;
118 int bbw, bbh, bbx, bby;
119 int val1;
120
121 len = fontp->size;
122 start = fontp->font;
123
124 fontp->yoffset = 0;
125 fontp->relative_compose = 0;
126 fontp->default_ascent = 0;
127
128 fontp->registry = NULL;
129 fontp->encoding = NULL;
130 fontp->slant = NULL;
131/* fontp->width = NULL; */
132
133 flag = proceed_file_line("FONTBOUNDINGBOX", start, &len,
134 (char **)&p, (char **)&q);
135 if (!flag) return 0;
136 bbw = strtol(p, (char **)&start, 10);
137 p = start;
138 bbh = strtol(p, (char **)&start, 10);
139 p = start;
140 bbx = strtol(p, (char **)&start, 10);
141 p = start;
142 bby = strtol(p, (char **)&start, 10);
143
144 fontp->llx = bbx;
145 fontp->lly = bby;
146 fontp->urx = bbw + bbx;
147 fontp->ury = bbh + bby;
148 fontp->width = bbw;
149 fontp->height = bbh;
150 start = q;
151 flag = proceed_file_line("STARTPROPERTIES", start, &len,
152 (char **)&p, (char **)&q);
153 if (!flag) return 1;
154
155 flag = 0;
156
157 do {
158 start = q;
159 if (search_file_line("PIXEL_SIZE", start, len,
160 (char **)&p, (char **)&q) == 1)
161 {
162 val1 = atoi(p);
163 fontp->pixsz = val1;
164 }
165 else if (search_file_line("FONT_ASCENT", start, len,
166 (char **)&p, (char **)&q) == 1)
167 {
168 val1 = atoi(p);
169 fontp->ury = val1;
170 }
171 else if (search_file_line("FONT_DESCENT", start, len,
172 (char **)&p, (char **)&q) == 1)
173 {
174 val1 = atoi(p);
175 fontp->lly = -val1;
176 }
177 else if (search_file_line("_MULE_BASELINE_OFFSET", start, len,
178 (char **)&p, (char **)&q) == 1)
179 {
180 val1 = atoi(p);
181 fontp->yoffset = -val1;
182 }
183 else if (search_file_line("_MULE_RELATIVE_COMPOSE", start, len,
184 (char **)&p, (char **)&q) == 1)
185 {
186 val1 = atoi(p);
187 fontp->relative_compose = val1;
188 }
189 else if (search_file_line("_MULE_DEFAULT_ASCENT", start, len,
190 (char **)&p, (char **)&q) == 1)
191 {
192 val1 = atoi(p);
193 fontp->default_ascent = val1;
194 }
195 else if (search_file_line("CHARSET_REGISTRY", start, len,
196 (char **)&p, (char **)&q) == 1)
197 {
198 fontp->registry = get_quoted_string(p, q);
199 }
200 else if (search_file_line("CHARSET_ENCODING", start, len,
201 (char **)&p, (char **)&q) == 1)
202 {
203 fontp->encoding = get_quoted_string(p, q);
204 }
205 else if (search_file_line("SLANT", start, len,
206 (char **)&p, (char **)&q) == 1)
207 {
208 fontp->slant = get_quoted_string(p, q);
209 }
210/*
211 else if (search_file_line("SETWIDTH_NAME", start, len,
212 (char **)&p, (char **)&q) == 1)
213 {
214 fontp->width = get_quoted_string(p, q);
215 }
216*/
217 else
218 {
219 flag = search_file_line("ENDPROPERTIES", start, len,
220 (char **)&p, (char **)&q);
221 }
222 if (flag == -1) return 0;
223 len -= (q - start);
224 }while(flag == 0);
225 start = q;
226 flag = proceed_file_line("CHARS", start, &len, (char **)&p, (char **)&q);
227 if (!flag) return 0;
228 fontp->nchars = atoi(p);
229 fontp->seeked = q;
230
231 return 1;
232}
233
234bdffont*
235w32_init_bdf_font(char *filename)
236{
237 HANDLE hfile, hfilemap;
238 bdffont *bdffontp;
239 unsigned char *font;
240 BY_HANDLE_FILE_INFORMATION fileinfo;
241 int i;
242
243 if (hbdf_cp_heap == INVALID_HANDLE_VALUE)
244 hbdf_cp_heap = HeapCreate(0, BDF_CODEPOINT_HEAP_INITIAL_SIZE, 0);
245 if (hbdf_bmp_heap == INVALID_HANDLE_VALUE)
246 hbdf_bmp_heap = HeapCreate(0, BDF_BITMAP_HEAP_INITIAL_SIZE, 0);
247
248 if (!hbdf_cp_heap || !hbdf_bmp_heap)
249 error("Fail to create heap for BDF");
250
251 hfile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
252 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
253 if (hfile == INVALID_HANDLE_VALUE) return NULL;
254 if (!GetFileInformationByHandle(hfile, &fileinfo) ||
255 (fileinfo.nFileSizeHigh != 0) ||
256 (fileinfo.nFileSizeLow > BDF_FILE_SIZE_MAX))
257 {
258 CloseHandle(hfile);
259 error("Fail to open BDF file");
260 }
261 hfilemap = CreateFileMapping(hfile, NULL, PAGE_READONLY, 0, 0, NULL);
262 if (!hfilemap)
263 {
264 CloseHandle(hfile);
265 error("Can't map font");
266 }
267
268 font = MapViewOfFile(hfilemap, FILE_MAP_READ, 0, 0, 0);
269
270 if (!font)
271 {
272 CloseHandle(hfile);
273 CloseHandle(hfilemap);
274 error("Can't view font");
275 }
276
277 bdffontp = (bdffont *) xmalloc(sizeof(bdffont));
278
279 for(i = 0;i < BDF_FIRST_OFFSET_TABLE;i++)
280 bdffontp->chtbl[i] = NULL;
281 bdffontp->size = fileinfo.nFileSizeLow;
282 bdffontp->font = font;
283 bdffontp->hfile = hfile;
284 bdffontp->hfilemap = hfilemap;
285 bdffontp->filename = (char*) xmalloc(strlen(filename) + 1);
286 strcpy(bdffontp->filename, filename);
287
288 if (!set_bdf_font_info(bdffontp))
289 {
290 w32_free_bdf_font(bdffontp);
291 error("Invalid BDF font!");
292 }
293 return bdffontp;
294}
295
296void
297w32_free_bdf_font(bdffont *fontp)
298{
299 int i, j;
300 font_char *pch;
301 cache_bitmap *pcb;
302
303 UnmapViewOfFile(fontp->font);
304 CloseHandle(fontp->hfilemap);
305 CloseHandle(fontp->hfile);
306
307 xfree(fontp->registry);
308 xfree(fontp->encoding);
309 xfree(fontp->slant);
310/* xfree(fontp->width); */
311
312 xfree(fontp->filename);
313 for(i = 0;i < BDF_FIRST_OFFSET_TABLE;i++)
314 {
315 pch = fontp->chtbl[i];
316 if (pch)
317 {
318 for (j = 0;j < BDF_SECOND_OFFSET_TABLE;j++)
319 {
320 pcb = pch[j].pcbmp;
321 if (pcb)
322 {
323 if (pcb->pbmp)
324 HeapFree(hbdf_bmp_heap, 0, pcb->pbmp);
325 pcb->psrc = NULL;
326 }
327 }
328 HeapFree(hbdf_cp_heap, 0, pch);
329 }
330 }
331 xfree(fontp);
332}
333
334static font_char*
335get_cached_font_char(bdffont *fontp, int index)
336{
337 font_char *pch, *result;
338
339 if (!BDF_CODEPOINT_RANGE_COVER_P(index))
340 return NULL;
341
342 pch = fontp->chtbl[BDF_FIRST_OFFSET(index)];
343 if (!pch)
344 return NULL;
345
346 result = &pch[BDF_SECOND_OFFSET(index)];
347
348 if (!result->offset) return NULL;
349
350 return result;
351}
352
353static font_char*
354cache_char_offset(bdffont *fontp, int index, unsigned char *offset)
355{
356 font_char *pch, *result;
357
358 if (!BDF_CODEPOINT_RANGE_COVER_P(index))
359 return NULL;
360
361 pch = fontp->chtbl[BDF_FIRST_OFFSET(index)];
362 if (!pch)
363 {
364 pch = fontp->chtbl[BDF_FIRST_OFFSET(index)] =
365 (font_char*) HeapAlloc(hbdf_cp_heap,
366 HEAP_ZERO_MEMORY,
367 sizeof(font_char) *
368 BDF_SECOND_OFFSET_TABLE);
369 if (!pch) return NULL;
370 /* memset(pch, 0, sizeof(font_char) * BDF_SECOND_OFFSET_TABLE); */
371 }
372
373 result = &pch[BDF_SECOND_OFFSET(index)];
374 result->offset = offset;
375
376 return result;
377}
378
379static font_char*
380seek_char(bdffont *fontp, int index)
381{
382 font_char *result;
383 int len, flag, font_index;
384 unsigned char *start, *p, *q;
385
386 if (!fontp->seeked) return NULL;
387
388 start = fontp->seeked;
389 len = fontp->size - (start - fontp->font);
390
391 do {
392 flag = proceed_file_line("ENCODING", start, &len,
393 (char **)&p, (char **)&q);
394 if (!flag)
395 {
396 fontp->seeked = NULL;
397 return NULL;
398 }
399 font_index = atoi(p);
400 result = cache_char_offset(fontp, font_index, q);
401 if (!result) return NULL;
402
403 start = result->offset;
404 } while (font_index != index);
405 fontp->seeked = start;
406
407 return result;
408}
409
410static void
411clear_cached_bitmap_slots()
412{
413 int i;
414 cache_bitmap *p;
415
416 p = pcached_bitmap_latest;
417 for (i = 0;i < BDF_FONT_CLEAR_SIZE;i++)
418 {
419 if (p->psrc)
420 {
421 if (p->pbmp)
422 HeapFree(hbdf_bmp_heap, 0, p->pbmp);
423 p->psrc->pcbmp = NULL;
424 p->psrc = NULL;
425 }
426 p++;
427 if (FONT_CACHE_SLOT_OVER_P(p))
428 p = cached_bitmap_slots;
429 }
430}
431
432#define GET_HEX_VAL(x) ((isdigit(x)) ? ((x) - '0') : \
433 (((x) >= 'A') && ((x) <= 'F')) ? ((x) - 'A' + 10) : \
434 (((x) >= 'a') && ((x) <= 'f')) ? ((x) - 'a' + 10) : \
435 (-1))
436
437int
438w32_get_bdf_glyph(bdffont *fontp, int index, int size, glyph_struct *glyph)
439{
440 font_char *pch;
441 unsigned char *start, *p, *q, *bitmapp;
442 unsigned char val, val1, val2;
443 int i, j, len, flag, consumed;
444 int align, rowbytes;
445
446 pch = get_cached_font_char(fontp, index);
447 if (!pch)
448 {
449 pch = seek_char(fontp, index);
450 if (!pch)
451 return 0;
452 }
453
454 start = pch->offset;
455
456 if ((size == 0) && pch->pcbmp)
457 {
458 glyph->metric = pch->pcbmp->metric;
459 return 1;
460 }
461
462 len = fontp->size - (start - fontp->font);
463
464 flag = proceed_file_line("DWIDTH", start, &len, (char **)&p, (char **)&q);
465 if (!flag)
466 return 0;
467 glyph->metric.dwidth = atoi(p);
468
469 start = q;
470 flag = proceed_file_line("BBX", start, &len, (char **)&p, (char **)&q);
471 if (!flag)
472 return 0;
473 glyph->metric.bbw = strtol(p, (char **)&start, 10);
474 p = start;
475 glyph->metric.bbh = strtol(p, (char **)&start, 10);
476 p = start;
477 glyph->metric.bbox = strtol(p, (char **)&start, 10);
478 p = start;
479 glyph->metric.bboy = strtol(p, (char **)&start, 10);
480
481 if (size == 0) return 1;
482
483 start = q;
484 flag = proceed_file_line("BITMAP", start, &len, (char **)&p, (char **)&q);
485 if (!flag)
486 return 0;
487
488 consumed = 0;
489 flag = 0;
490 p = q;
491 bitmapp = glyph->bitmap;
492 rowbytes = (glyph->metric.bbw + 7) / 8;
493 /* DIB requires DWORD alignment. */
494 align = sizeof(DWORD) - rowbytes % sizeof(DWORD);
495 consumed = glyph->metric.bbh * (rowbytes + align);
496 glyph->bitmap_size = consumed;
497 glyph->row_byte_size = rowbytes;
498 if (size < consumed) return 0;
499
500 for(i = 0;i < glyph->metric.bbh;i++)
501 {
502 q = memchr(p, '\n', len);
503 if (!q) return 0;
504 for(j = 0;((q > p) && (j < rowbytes));j++)
505 {
506 int ival = GET_HEX_VAL(*p);
507
508 if (ival == -1) return 0;
509 val1 = ival;
510 p++;
511 ival = GET_HEX_VAL(*p);
512 if (ival == -1) return 0;
513 val2 = ival;
514 p++;
515 val = (unsigned char)((val1 << 4) | val2);
516 if (val) flag = 1;
517 *bitmapp++ = val;
518 }
519 for(j = 0;j < align;j++)
520 *bitmapp++ = 0x00;
521 p = q + 1;
522 }
523
524 /* If this glyph is white space, return -1. */
525 if (flag == 0) return -1;
526
527 return consumed;
528}
529
530static
531cache_bitmap*
532get_bitmap_with_cache(bdffont *fontp, int index)
533{
534 int bitmap_size, bitmap_real_size;
535 font_char *pch;
536 cache_bitmap* pcb;
537 unsigned char *pbmp;
538 glyph_struct glyph;
539
540 pch = get_cached_font_char(fontp, index);
541 if (pch)
542 {
543 pcb = pch->pcbmp;
544 if (pcb) return pcb;
545 }
546
547 bitmap_size = ((fontp->urx - fontp->llx) / 8 + 3) * (fontp->ury - fontp->lly)
548 + 256;
549 glyph.bitmap = (unsigned char*) alloca(sizeof(unsigned char) * bitmap_size);
550
551 bitmap_real_size = w32_get_bdf_glyph(fontp, index, bitmap_size, &glyph);
552
553 if (bitmap_real_size == 0)
554 return NULL;
555
556 pch = get_cached_font_char(fontp, index);
557 if (!pch) return NULL;
558
559 if (bitmap_real_size > 0)
560 {
561 pbmp = (unsigned char*) HeapAlloc(hbdf_bmp_heap, 0,
562 bitmap_real_size);
563 if (!pbmp) return NULL;
564 memcpy(pbmp, glyph.bitmap, bitmap_real_size);
565 }
566 else
567 pbmp = NULL; /* white space character */
568
569 pcb = pcached_bitmap_latest;
570 if (pcb->psrc)
571 clear_cached_bitmap_slots();
572
573 pcb->psrc = pch;
574 pcb->metric = glyph.metric;
575 pcb->pbmp = pbmp;
576 pcb->bitmap_size = glyph.bitmap_size;
577 pcb->row_byte_size = glyph.row_byte_size;
578
579 pch->pcbmp = pcb;
580
581 pcached_bitmap_latest++;
582 if (FONT_CACHE_SLOT_OVER_P(pcached_bitmap_latest))
583 pcached_bitmap_latest = cached_bitmap_slots;
584
585 return pcb;
586}
587
588static HBITMAP
589create_offscreen_bitmap(HDC hdc, int width, int height, unsigned char **bitsp)
590{
591 struct {
592 BITMAPINFOHEADER h;
593 RGBQUAD c[2];
594 } info;
595
596 memset(&info, 0, sizeof(info));
597 info.h.biSize = sizeof(BITMAPINFOHEADER);
598 info.h.biWidth = width;
599 info.h.biHeight = -height;
600 info.h.biPlanes = 1;
601 info.h.biBitCount = 1;
602 info.h.biCompression = BI_RGB;
603 info.c[1].rgbRed = info.c[1].rgbGreen = info.c[1].rgbBlue = 255;
604
605 return CreateDIBSection(hdc, (LPBITMAPINFO)&info,
606 DIB_RGB_COLORS, (void **)bitsp, NULL, 0);
607}
608
609glyph_metric *
610w32_BDF_TextMetric(bdffont *fontp, unsigned char *text, int dim)
611{
612 int index;
613 cache_bitmap *pcb;
614
615 if (dim == 1)
616 index = *text;
617 else
618 index = MAKELENDSHORT(text[1], text[0]);
619
620 pcb = get_bitmap_with_cache(fontp, index);
621 if (!pcb)
622 return NULL;
623
624 return &(pcb->metric);
625}
626
627int
628w32_BDF_TextOut(bdffont *fontp, HDC hdc, int left,
629 int top, unsigned char *text, int dim, int bytelen,
630 int fixed_pitch_size)
631{
632 int index, btop;
633 unsigned char *textp;
634 cache_bitmap *pcb;
635 HBRUSH hFgBrush, hOrgBrush;
636 HANDLE horgobj;
637 UINT textalign;
638 int width, height;
639 HDC hCompatDC;
640 int ret = 1;
641 static HBITMAP hBMP = 0;
642 static HDC DIBsection_hdc = 0;
643 static int DIBsection_width, DIBsection_height;
644 static unsigned char *bits;
645
646 hCompatDC = CreateCompatibleDC(hdc);
647 if (!hCompatDC)
648 return 0;
649
650 textalign = GetTextAlign(hdc);
651
652 hFgBrush = CreateSolidBrush(GetTextColor(hdc));
653 hOrgBrush = SelectObject(hdc, hFgBrush);
654
655 textp = text;
656
657 while(bytelen > 0)
658 {
659 if (dim == 1)
660 {
661 index = *textp++;
662 bytelen--;
663 }
664 else
665 {
666 bytelen -= 2;
667 if (bytelen < 0) break;
668 index = MAKELENDSHORT(textp[0], textp[1]);
669 textp += 2;
670 }
671 pcb = get_bitmap_with_cache(fontp, index);
672 if (!pcb)
673 {
674 ret = 0;
675 break;
676 }
677 if (pcb->pbmp)
678 {
679 width = pcb->metric.bbw;
680 height = pcb->metric.bbh;
681
682 if (!(hBMP
683 && (DIBsection_hdc == hdc)
684 && (DIBsection_width == width)
685 && (DIBsection_height == height)))
686 {
687 if (hBMP) DeleteObject(hBMP);
688 hBMP = create_offscreen_bitmap(hdc, width, height, &bits);
689 DIBsection_hdc = hdc;
690 DIBsection_width = width;
691 DIBsection_height = height;
692 if (!hBMP) return 0;
693 }
694
695 memcpy(bits, pcb->pbmp, pcb->bitmap_size);
696
697 if (textalign & TA_BASELINE)
698 btop = top - (pcb->metric.bbh + pcb->metric.bboy);
699 else if (textalign & TA_BOTTOM)
700 btop = top - pcb->metric.bbh;
701 else
702 btop = top;
703
704 horgobj = SelectObject(hCompatDC, hBMP);
705 BitBlt(hdc, left, btop, width, height, hCompatDC, 0, 0, 0xE20746);
706 SelectObject(hCompatDC, horgobj);
707 }
708
709 if (fixed_pitch_size)
710 left += fixed_pitch_size;
711 else
712 left += pcb->metric.dwidth;
713 }
714
715 DeleteDC(hCompatDC);
716
717 SelectObject(hdc, hOrgBrush);
718 DeleteObject(hFgBrush);
719
720 return ret;
721}
722
723struct font_info *w32_load_bdf_font (struct frame *f, char *fontname,
724 int size, char* filename)
725{
726 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
727 struct font_info *fontp;
728 XFontStruct *font;
729 bdffont* bdf_font;
730
731 bdf_font = w32_init_bdf_font (filename);
732
733 if (!bdf_font) return NULL;
734
735 font = (XFontStruct *) xmalloc (sizeof (XFontStruct));
736 bzero (font, sizeof (*font));
737
738 font->bdf = bdf_font;
739 font->hfont = 0;
740
741 /* NTEMACS_TODO: Better way of determining if a font is double byte
742 or not. */
743 font->double_byte_p = bdf_font->nchars > 255 ? 1 : 0;
744
745 w32_cache_char_metrics (font);
746
747 /* Do we need to create the table? */
748 if (dpyinfo->font_table_size == 0)
749 {
750 dpyinfo->font_table_size = 16;
751 dpyinfo->font_table
752 = (struct font_info *) xmalloc (dpyinfo->font_table_size
753 * sizeof (struct font_info));
754 }
755 /* Do we need to grow the table? */
756 else if (dpyinfo->n_fonts
757 >= dpyinfo->font_table_size)
758 {
759 dpyinfo->font_table_size *= 2;
760 dpyinfo->font_table
761 = (struct font_info *) xrealloc (dpyinfo->font_table,
762 (dpyinfo->font_table_size
763 * sizeof (struct font_info)));
764 }
765
766 fontp = dpyinfo->font_table + dpyinfo->n_fonts;
767
768 /* Now fill in the slots of *FONTP. */
769 BLOCK_INPUT;
770 bzero (fontp, sizeof (*fontp));
771 fontp->font = font;
772 fontp->font_idx = dpyinfo->n_fonts;
773 fontp->name = (char *) xmalloc (strlen (fontname) + 1);
774 bcopy (fontname, fontp->name, strlen (fontname) + 1);
775 fontp->full_name = fontp->name;
776 /* FIXME: look at BDF spec to see if there are better ways of finding
777 average_width and space_width, hopefully that don't involve working out
778 the values for ourselves from the data. */
779 fontp->size = fontp->average_width = fontp->space_width = FONT_WIDTH (font);
780 fontp->height = FONT_HEIGHT (font);
781
782 /* The slot `encoding' specifies how to map a character
783 code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to
784 the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, 0:0x2020..0x7F7F,
785 the font code-points (0:0x20..0x7F, 1:0xA0..0xFF,
786 0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF, or
787 2:0xA020..0xFF7F). For the moment, we don't know which charset
788 uses this font. So, we set informatoin in fontp->encoding[1]
789 which is never used by any charset. If mapping can't be
790 decided, set FONT_ENCODING_NOT_DECIDED. */
791 fontp->encoding_type = FONT_ENCODING_NOT_DECIDED;
792 fontp->baseline_offset = bdf_font->yoffset;
793 fontp->relative_compose = bdf_font->relative_compose;
794 fontp->default_ascent = bdf_font->default_ascent;
795
796 /* Set global flag fonts_changed_p to non-zero if the font loaded
797 has a character with a smaller width than any other character
798 before, or if the font loaded has a smaller height than any
799 other font loaded before. If this happens, it will make a
800 glyph matrix reallocation necessary. */
801 fonts_changed_p |= x_compute_min_glyph_bounds (f);
802
803 UNBLOCK_INPUT;
804 dpyinfo->n_fonts++;
805 return fontp;
806}
807
808/* Check a file for an XLFD string describing it. */
809int w32_BDF_to_x_font (char *file, char* xstr, int len)
810{
811 HANDLE hfile, hfilemap;
812 BY_HANDLE_FILE_INFORMATION fileinfo;
813 char *font, *start, *p, *q;
814 int flag, size, retval = 0;
815
816 hfile = CreateFile (file, GENERIC_READ, FILE_SHARE_READ, NULL,
817 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
818 if (hfile == INVALID_HANDLE_VALUE) return 0;
819 if (!GetFileInformationByHandle(hfile, &fileinfo) ||
820 (fileinfo.nFileSizeHigh != 0) ||
821 (fileinfo.nFileSizeLow > BDF_FILE_SIZE_MAX))
822 {
823 CloseHandle (hfile);
824 return 0;
825 }
826 size = fileinfo.nFileSizeLow;
827
828 hfilemap = CreateFileMapping (hfile, NULL, PAGE_READONLY, 0, 0, NULL);
829 if (!hfilemap)
830 {
831 CloseHandle (hfile);
832 return 0;
833 }
834
835 font = MapViewOfFile (hfilemap, FILE_MAP_READ, 0, 0, 0);
836 if (!font)
837 {
838 CloseHandle (hfile);
839 CloseHandle (hfilemap);
840 return 0;
841 }
842 start = font;
843
844 flag = proceed_file_line ("FONT ", start, &size, &p, &q);
845 if (flag)
846 {
847 /* If font provides a description of itself, check it is a
848 full XLFD before accepting it. */
849 int count = 0;
850 char *s;
851
852 for (s = p; s < q; s++)
853 if (*s == '\n')
854 break;
855 else if (*s == '-')
856 count++;
857 if (count == 14 && q - p - 1 <= len)
858 {
859 strncpy (xstr, p, q-p-1);
860 xstr[q-p-1] = '\0';
861 /* Files may have DOS line ends (ie still ^M on end). */
862 if (iscntrl(xstr[q-p-2]))
863 xstr[q-p-2] = '\0';
864
865 retval = 1;
866 }
867 }
868 UnmapViewOfFile (font);
869 CloseHandle (hfile);
870 CloseHandle (hfilemap);
871 return retval;
872}
873
874/* arch-tag: 2e9a45de-0c54-4a0e-95c8-2d67b2b1fa32
875 (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 @@
1/* Definitions and header for handling BDF fonts on the Microsoft W32 API.
2 Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005,
3 2006, 2007, 2008 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20/* Based heavily on code by H. Miyashita for Meadow (a descendant of
21 MULE for W32). */
22
23#ifndef EMACS_W32BDF_H
24#define EMACS_W32BDF_H
25
26#define BDF_FIRST_OFFSET_TABLE 0x200
27#define BDF_SECOND_OFFSET_TABLE 0x80
28#define BDF_SECOND_OFFSET(x) ((x) & 0x7f)
29#define BDF_FIRST_OFFSET(x) (((x) >> 8) | (((x) & 0x80) << 1))
30#define BDF_CODEPOINT_MAX (BDF_FIRST_OFFSET_TABLE * BDF_SECOND_OFFSET_TABLE)
31#define BDF_CODEPOINT_RANGE_COVER_P(x) (((x) >= 0) && ((x) <= BDF_CODEPOINT_MAX))
32
33#define BDF_FONT_CACHE_SIZE 3000
34#define BDF_FONT_CLEAR_SIZE 600
35
36/*
37 GLYPH METRIC (# ... character's reference point)
38 ^
39 y | (urx, ury)
40 | ^ +----------------+
41 a | b| |character | <- font bounding Box
42 x | b| | |
43 i | h| | #(bbox, bboy) |
44 s | v +----------------+
45 | (llx, lly)
46 | <---------------->
47 | bbw
48 +----------------------->
49 origin x axis
50 */
51
52
53
54/* Structure of glyph information of one character. */
55typedef struct
56{
57 int dwidth; /* width in pixels */
58 int bbw, bbh, bbox, bboy; /* bounding box in pixels */
59} glyph_metric;
60
61typedef struct
62{
63 glyph_metric metric;
64 int row_byte_size; /* size in bytes occupied by one row of the bitmap */
65 int bitmap_size; /* size in bytes of the following slots */
66 unsigned char *bitmap; /* */
67} glyph_struct;
68
69typedef struct fchar *pfont_char;
70
71typedef struct
72{
73 glyph_metric metric;
74 pfont_char psrc;
75 int row_byte_size;
76 int bitmap_size;
77 unsigned char *pbmp;
78} cache_bitmap;
79
80typedef struct fchar
81{
82 unsigned char *offset;
83 cache_bitmap *pcbmp;
84} font_char;
85
86typedef struct
87{
88 char *filename;
89 HANDLE hfile;
90 HANDLE hfilemap;
91 unsigned char *font;
92 unsigned char *seeked;
93 DWORD size;
94 font_char *chtbl[BDF_FIRST_OFFSET_TABLE];
95 int llx, lly, urx, ury; /* Font bounding box */
96
97 int yoffset;
98 int relative_compose;
99 int default_ascent;
100
101 unsigned char *registry;
102 unsigned char *encoding;
103 unsigned char *slant;
104/* unsigned char *width; */
105
106 int width;
107 int height;
108 int pixsz;
109 int nchars;
110} bdffont;
111
112#define BDF_FILE_SIZE_MAX 256*1024*1024 /* 256Mb */
113#define BDF_FONT_FILE(font) (((bdffont*)(font))->filename)
114#define MAKELENDSHORT(c1, c2) (unsigned short)((c1) | ((c2) << 8))
115
116bdffont *w32_init_bdf_font (char *filename);
117void w32_free_bdf_font (bdffont *fontp);
118int w32_get_bdf_glyph (bdffont *fontp, int index, int size,
119 glyph_struct *glyph);
120int w32_BDF_TextOut (bdffont *fontp, HDC hdc, int left,
121 int top, unsigned char *text, int dim,
122 int bytelen, int fixed_pitch_size);
123int w32_BDF_to_x_font (char *file, char* xstr, int len);
124
125#endif /* EMACS_W32BDF_H */
126
127/* arch-tag: 7499e9f2-197e-44cc-9274-373f00b51eec
128 (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)
234 struct font *font; 234 struct font *font;
235{ 235{
236 struct w32font_info *w32_font = (struct w32font_info *) font; 236 struct w32font_info *w32_font = (struct w32font_info *) font;
237 237 DeleteObject (w32_font->hfont);
238 if (w32_font->compat_w32_font)
239 {
240 W32FontStruct *old_w32_font = w32_font->compat_w32_font;
241 DeleteObject (old_w32_font->hfont);
242 xfree (old_w32_font);
243 w32_font->compat_w32_font = 0;
244 }
245} 238}
246 239
247/* w32 implementation of has_char for font backend. 240/* w32 implementation of has_char for font backend.
@@ -314,7 +307,7 @@ w32font_encode_char (font, c)
314 f = XFRAME (selected_frame); 307 f = XFRAME (selected_frame);
315 308
316 dc = get_frame_dc (f); 309 dc = get_frame_dc (f);
317 old_font = SelectObject (dc, w32_font->compat_w32_font->hfont); 310 old_font = SelectObject (dc, w32_font->hfont);
318 311
319 /* GetCharacterPlacement is used here rather than GetGlyphIndices because 312 /* GetCharacterPlacement is used here rather than GetGlyphIndices because
320 it is supported on Windows NT 4 and 9x/ME. But it cannot reliably report 313 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)
367 WORD *wcode = NULL; 360 WORD *wcode = NULL;
368 SIZE size; 361 SIZE size;
369 362
363 struct w32font_info *w32_font = (struct w32font_info *) font;
364
370 if (metrics) 365 if (metrics)
371 { 366 {
372 struct w32font_info *w32_font = (struct w32font_info *) font;
373
374 bzero (metrics, sizeof (struct font_metrics)); 367 bzero (metrics, sizeof (struct font_metrics));
375 metrics->ascent = font->ascent; 368 metrics->ascent = font->ascent;
376 metrics->descent = font->descent; 369 metrics->descent = font->descent;
@@ -419,7 +412,7 @@ w32font_text_extents (font, code, nglyphs, metrics)
419 f = XFRAME (selected_frame); 412 f = XFRAME (selected_frame);
420 413
421 dc = get_frame_dc (f); 414 dc = get_frame_dc (f);
422 old_font = SelectObject (dc, FONT_COMPAT (font)->hfont); 415 old_font = SelectObject (dc, w32_font->hfont);
423 } 416 }
424 compute_metrics (dc, w32_font, *(code + i), char_metric); 417 compute_metrics (dc, w32_font, *(code + i), char_metric);
425 } 418 }
@@ -476,7 +469,7 @@ w32font_text_extents (font, code, nglyphs, metrics)
476 f = XFRAME (selected_frame); 469 f = XFRAME (selected_frame);
477 470
478 dc = get_frame_dc (f); 471 dc = get_frame_dc (f);
479 old_font = SelectObject (dc, FONT_COMPAT (font)->hfont); 472 old_font = SelectObject (dc, w32_font->hfont);
480 } 473 }
481 474
482 if (GetTextExtentPoint32W (dc, wcode, nglyphs, &size)) 475 if (GetTextExtentPoint32W (dc, wcode, nglyphs, &size))
@@ -765,8 +758,6 @@ w32font_open_internal (f, font_entity, pixel_size, font_object)
765 HDC dc; 758 HDC dc;
766 HFONT hfont, old_font; 759 HFONT hfont, old_font;
767 Lisp_Object val, extra; 760 Lisp_Object val, extra;
768 /* For backwards compatibility. */
769 W32FontStruct *compat_w32_font;
770 struct w32font_info *w32_font; 761 struct w32font_info *w32_font;
771 struct font * font; 762 struct font * font;
772 OUTLINETEXTMETRIC* metrics = NULL; 763 OUTLINETEXTMETRIC* metrics = NULL;
@@ -832,15 +823,7 @@ w32font_open_internal (f, font_entity, pixel_size, font_object)
832 SelectObject (dc, old_font); 823 SelectObject (dc, old_font);
833 release_frame_dc (f, dc); 824 release_frame_dc (f, dc);
834 825
835 /* W32FontStruct - we should get rid of this, and use the w32font_info 826 w32_font->hfont = hfont;
836 struct for any W32 specific fields. font->font.font can then be hfont. */
837 w32_font->compat_w32_font = xmalloc (sizeof (W32FontStruct));
838 compat_w32_font = w32_font->compat_w32_font;
839 bzero (compat_w32_font, sizeof (W32FontStruct));
840 compat_w32_font->font_type = UNICODE_FONT;
841 /* Duplicate the text metrics. */
842 bcopy (&w32_font->metrics, &compat_w32_font->tm, sizeof (TEXTMETRIC));
843 compat_w32_font->hfont = hfont;
844 827
845 { 828 {
846 char *name; 829 char *name;
@@ -912,11 +895,6 @@ w32font_open_internal (f, font_entity, pixel_size, font_object)
912 font->underline_position = -1; 895 font->underline_position = -1;
913 } 896 }
914 897
915 /* max_descent is used for underlining in w32term.c. Hopefully this
916 is temporary, as we'll want to get rid of the old compatibility
917 stuff later. */
918 compat_w32_font->max_bounds.descent = font->descent;
919
920 /* For temporary compatibility with legacy code that expects the 898 /* For temporary compatibility with legacy code that expects the
921 name to be usable in x-list-fonts. Eventually we expect to change 899 name to be usable in x-list-fonts. Eventually we expect to change
922 x-list-fonts and other places that use fonts so that this can be 900 x-list-fonts and other places that use fonts so that this can be
@@ -2070,7 +2048,7 @@ in the font selection dialog. */)
2070 /* Initialize as much of the font details as we can from the current 2048 /* Initialize as much of the font details as we can from the current
2071 default font. */ 2049 default font. */
2072 hdc = GetDC (FRAME_W32_WINDOW (f)); 2050 hdc = GetDC (FRAME_W32_WINDOW (f));
2073 oldobj = SelectObject (hdc, FONT_COMPAT (FRAME_FONT (f))->hfont); 2051 oldobj = SelectObject (hdc, ((struct w32font_info *) FRAME_FONT (f))->hfont);
2074 GetTextFace (hdc, LF_FACESIZE, lf.lfFaceName); 2052 GetTextFace (hdc, LF_FACESIZE, lf.lfFaceName);
2075 if (GetTextMetrics (hdc, &tm)) 2053 if (GetTextMetrics (hdc, &tm))
2076 { 2054 {
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
53 unsigned int glyph_idx; 53 unsigned int glyph_idx;
54 struct w32_metric_cache **cached_metrics; 54 struct w32_metric_cache **cached_metrics;
55 int n_cache_blocks; 55 int n_cache_blocks;
56 W32FontStruct *compat_w32_font; 56 HFONT hfont;
57}; 57};
58 58
59#define FONT_COMPAT(f) (((struct w32font_info *) (f))->compat_w32_font)
60
61#define CACHE_BLOCKSIZE 128 59#define CACHE_BLOCKSIZE 128
62 60
63Lisp_Object w32font_get_cache P_ ((FRAME_PTR fe)); 61Lisp_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/>. */
21#define EMACS_W32GUI_H 21#define EMACS_W32GUI_H
22#include <windows.h> 22#include <windows.h>
23 23
24#include "w32bdf.h"
25
26/* Emulate XCharStruct. */
27typedef struct _XCharStruct
28{
29 short rbearing;
30 short lbearing;
31 short width;
32 short ascent;
33 short descent;
34} XCharStruct;
35 24
36/* Emulate widget_value from ../lwlib/lwlib.h, modified for Windows. */ 25/* Emulate widget_value from ../lwlib/lwlib.h, modified for Windows. */
37typedef void * XtPointer; 26typedef void * XtPointer;
@@ -100,30 +89,6 @@ typedef struct _widget_value
100#define malloc_widget_value() ((widget_value *) local_alloc (sizeof (widget_value))) 89#define malloc_widget_value() ((widget_value *) local_alloc (sizeof (widget_value)))
101#define free_widget_value(wv) (local_free ((wv))) 90#define free_widget_value(wv) (local_free ((wv)))
102 91
103
104enum w32_char_font_type
105{
106 UNKNOWN_FONT = 0 /* FONT_TYPE_UNKNOWN */,
107 ANSI_FONT,
108 UNICODE_FONT,
109 BDF_1D_FONT,
110 BDF_2D_FONT
111};
112
113typedef struct W32FontStruct {
114 enum w32_char_font_type font_type;
115 TEXTMETRIC tm;
116 HFONT hfont;
117 bdffont *bdf;
118 int double_byte_p;
119 XCharStruct max_bounds;
120 XCharStruct scratch;
121 /* Only store info for ascii chars, if not fixed pitch. */
122 XCharStruct * per_char;
123} W32FontStruct;
124
125typedef struct W32FontStruct XFontStruct;
126
127/* Emulate X GC's by keeping color and font info in a structure. */ 92/* Emulate X GC's by keeping color and font info in a structure. */
128typedef struct _XGCValues 93typedef struct _XGCValues
129{ 94{
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));
251void x_wm_set_window_state P_ ((struct frame *, int)); 251void x_wm_set_window_state P_ ((struct frame *, int));
252void x_wm_set_icon_pixmap P_ ((struct frame *, int)); 252void x_wm_set_icon_pixmap P_ ((struct frame *, int));
253static void w32_initialize P_ ((void)); 253static void w32_initialize P_ ((void));
254static void x_font_min_bounds P_ ((XFontStruct *, int *, int *));
255int x_compute_min_glyph_bounds P_ ((struct frame *));
256static void x_update_end P_ ((struct frame *)); 254static void x_update_end P_ ((struct frame *));
257static void w32_frame_up_to_date P_ ((struct frame *)); 255static void w32_frame_up_to_date P_ ((struct frame *));
258static void w32_set_terminal_modes P_ ((struct terminal *)); 256static void w32_set_terminal_modes P_ ((struct terminal *));
@@ -1239,6 +1237,7 @@ x_draw_glyph_string_foreground (s)
1239 struct glyph_string *s; 1237 struct glyph_string *s;
1240{ 1238{
1241 int i, x; 1239 int i, x;
1240 struct w32font_info * w32_font;
1242 HFONT old_font; 1241 HFONT old_font;
1243 1242
1244 /* If first glyph of S has a left box line, start drawing the text 1243 /* If first glyph of S has a left box line, start drawing the text
@@ -1259,8 +1258,10 @@ x_draw_glyph_string_foreground (s)
1259 SetBkColor (s->hdc, s->gc->background); 1258 SetBkColor (s->hdc, s->gc->background);
1260 SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT); 1259 SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT);
1261 1260
1262 if (s->font && FONT_COMPAT (s->font)->hfont) 1261 w32_font = (struct w32font_info *) s->font;
1263 old_font = SelectObject (s->hdc, FONT_COMPAT (s->font)->hfont); 1262
1263 if (w32_font && w32_font->hfont)
1264 old_font = SelectObject (s->hdc, w32_font->hfont);
1264 1265
1265 /* Draw characters of S as rectangles if S's font could not be 1266 /* Draw characters of S as rectangles if S's font could not be
1266 loaded. */ 1267 loaded. */
@@ -1278,7 +1279,6 @@ x_draw_glyph_string_foreground (s)
1278 else 1279 else
1279 { 1280 {
1280 int boff = s->font->baseline_offset; 1281 int boff = s->font->baseline_offset;
1281 struct font *font = s->font;
1282 int y; 1282 int y;
1283 1283
1284 if (s->font->vertical_centering) 1284 if (s->font->vertical_centering)
@@ -1287,14 +1287,14 @@ x_draw_glyph_string_foreground (s)
1287 y = s->ybase - boff; 1287 y = s->ybase - boff;
1288 if (s->for_overlaps 1288 if (s->for_overlaps
1289 || (s->background_filled_p && s->hl != DRAW_CURSOR)) 1289 || (s->background_filled_p && s->hl != DRAW_CURSOR))
1290 font->driver->draw (s, 0, s->nchars, x, y, 0); 1290 s->font->driver->draw (s, 0, s->nchars, x, y, 0);
1291 else 1291 else
1292 font->driver->draw (s, 0, s->nchars, x, y, 1); 1292 s->font->driver->draw (s, 0, s->nchars, x, y, 1);
1293 if (s->face->overstrike) 1293 if (s->face->overstrike)
1294 font->driver->draw (s, 0, s->nchars, x + 1, y, 0); 1294 s->font->driver->draw (s, 0, s->nchars, x + 1, y, 0);
1295 } 1295 }
1296 1296
1297 if (s->font && FONT_COMPAT (s->font)->hfont) 1297 if (w32_font && w32_font->hfont)
1298 SelectObject (s->hdc, old_font); 1298 SelectObject (s->hdc, old_font);
1299} 1299}
1300 1300
@@ -1306,6 +1306,7 @@ x_draw_composite_glyph_string_foreground (s)
1306{ 1306{
1307 int i, j, x; 1307 int i, j, x;
1308 HFONT old_font; 1308 HFONT old_font;
1309 struct w32font_info * w32_font;
1309 1310
1310 /* If first glyph of S has a left box line, start drawing the text 1311 /* If first glyph of S has a left box line, start drawing the text
1311 of S to the right of that box line. */ 1312 of S to the right of that box line. */
@@ -1325,8 +1326,10 @@ x_draw_composite_glyph_string_foreground (s)
1325 SetBkMode (s->hdc, TRANSPARENT); 1326 SetBkMode (s->hdc, TRANSPARENT);
1326 SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT); 1327 SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT);
1327 1328
1328 if (s->font && FONT_COMPAT (s->font)->hfont) 1329 w32_font = (struct w32font_info *) s->font;
1329 old_font = SelectObject (s->hdc, FONT_COMPAT (s->font)->hfont); 1330
1331 if (w32_font && w32_font->hfont)
1332 old_font = SelectObject (s->hdc, w32_font->hfont);
1330 1333
1331 /* Draw a rectangle for the composition if the font for the very 1334 /* Draw a rectangle for the composition if the font for the very
1332 first character of the composition could not be loaded. */ 1335 first character of the composition could not be loaded. */
@@ -1392,7 +1395,7 @@ x_draw_composite_glyph_string_foreground (s)
1392 } 1395 }
1393 } 1396 }
1394 1397
1395 if (s->font && FONT_COMPAT (s->font)->hfont) 1398 if (w32_font && w32_font->hfont)
1396 SelectObject (s->hdc, old_font); 1399 SelectObject (s->hdc, old_font);
1397} 1400}
1398 1401
@@ -2342,7 +2345,7 @@ x_draw_glyph_string (s)
2342 2345
2343 /* Draw strike-through. */ 2346 /* Draw strike-through. */
2344 if (s->face->strike_through_p 2347 if (s->face->strike_through_p
2345 && !FONT_COMPAT (s->font)->tm.tmStruckOut) 2348 && !((struct w32font_info *) s->font)->metrics.tmStruckOut)
2346 { 2349 {
2347 unsigned long h = 1; 2350 unsigned long h = 1;
2348 unsigned long dy = (s->height - h) / 2; 2351 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)
166 166
167 f = XFRAME (selected_frame); 167 f = XFRAME (selected_frame);
168 context = get_frame_dc (f); 168 context = get_frame_dc (f);
169 old_font = SelectObject (context, FONT_COMPAT (font)->hfont); 169 old_font = SelectObject (context, ((struct w32font_info *) font)->hfont);
170 170
171 features = otf_features (context, "GSUB"); 171 features = otf_features (context, "GSUB");
172 XSETCAR (capability, features); 172 XSETCAR (capability, features);
@@ -259,7 +259,7 @@ uniscribe_shape (lgstring)
259 259
260 f = XFRAME (selected_frame); 260 f = XFRAME (selected_frame);
261 context = get_frame_dc (f); 261 context = get_frame_dc (f);
262 old_font = SelectObject (context, FONT_COMPAT (font)->hfont); 262 old_font = SelectObject (context, uniscribe_font->w32_font.hfont);
263 263
264 glyphs = alloca (max_glyphs * sizeof (WORD)); 264 glyphs = alloca (max_glyphs * sizeof (WORD));
265 clusters = alloca (nchars * sizeof (WORD)); 265 clusters = alloca (nchars * sizeof (WORD));
@@ -424,7 +424,7 @@ uniscribe_encode_char (font, c)
424 /* Use selected frame until API is updated to pass the frame. */ 424 /* Use selected frame until API is updated to pass the frame. */
425 f = XFRAME (selected_frame); 425 f = XFRAME (selected_frame);
426 context = get_frame_dc (f); 426 context = get_frame_dc (f);
427 old_font = SelectObject (context, FONT_COMPAT (font)->hfont); 427 old_font = SelectObject (context, ((struct w32font_info *) font)->hfont);
428 428
429 retval = GetGlyphIndicesW (context, chars, 1, indices, 429 retval = GetGlyphIndicesW (context, chars, 1, indices,
430 GGI_MARK_NONEXISTING_GLYPHS); 430 GGI_MARK_NONEXISTING_GLYPHS);