Windows.Oberon.FontRes.Mod 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. (* ETH Oberon, Copyright 2000 ETH Zuerich Institut fuer Computersysteme, ETH Zentrum, CH-8092 Zuerich.
  2. Refer to the "General ETH Oberon System Source License" contract available at: http://www.oberon.ethz.ch/ *)
  3. MODULE FontRes IN Oberon; (** non-portable / source: Win32.FontRes.Mod *) (* MH 20.5.1994 *) (* Converts Oberon Fonts to Windows FON Resources *)
  4. IMPORT Out, Oberon, Texts, Files,SYSTEM;
  5. CONST
  6. Version = "Ver 1.0 (MH May 20 1994)";
  7. FontFileId = 0DBX;
  8. SPC = 20X;
  9. normal = 0; italic = 1; bold = 2; medium = 3; (* style *)
  10. TYPE
  11. FontInfo = RECORD (* Version 2.0 *)
  12. version: INTEGER;
  13. size: LONGINT;
  14. copyright: ARRAY 60 OF CHAR;
  15. type: INTEGER;
  16. points: INTEGER;
  17. vertRes, horizRes: INTEGER;
  18. ascent: INTEGER;
  19. internalLeading, externalLeading: INTEGER;
  20. italic, underline, strikeOut: CHAR;
  21. weight: INTEGER;
  22. charSet: CHAR;
  23. pixWidth, pixHeight: INTEGER;
  24. pitchAndFamily: CHAR;
  25. avgWidth, maxWidth: INTEGER;
  26. firstChar, lastChar, defaultChar, breakChar: CHAR;
  27. widthBytes: INTEGER;
  28. device: LONGINT;
  29. face: LONGINT;
  30. bitsPointer: LONGINT;
  31. bitsOffset: LONGINT;
  32. res: CHAR;
  33. END;
  34. CharEntry = RECORD
  35. width: INTEGER;
  36. offs: INTEGER;
  37. END;
  38. VAR
  39. oname: ARRAY 64 OF CHAR;
  40. Info: FontInfo;
  41. CharTab: ARRAY 257 OF CharEntry; (* one dummy entry at the end *)
  42. PowTwo: ARRAY 9 OF INTEGER; (* 2^0 .. 2^8 *)
  43. C: ARRAY 50 OF LONGINT; (* DOS Stub and New Executable Header *)
  44. PROCEDURE Append (VAR s: ARRAY OF CHAR; suff: ARRAY OF CHAR);
  45. VAR i, j, max: LONGINT;
  46. BEGIN
  47. i := 0; j := 0; max := LEN(s)-1;
  48. WHILE s[i] # 0X DO INC(i) END;
  49. WHILE (i < max) & (suff[j] # 0X) DO s[i] := suff[j]; INC(i); INC(j) END;
  50. s[i] := 0X;
  51. END Append;
  52. PROCEDURE WriteStringFix (VAR out: Files.Rider; s: ARRAY OF CHAR; len: INTEGER);
  53. VAR i: INTEGER; ch: CHAR;
  54. BEGIN i := 0;
  55. REPEAT ch := s[i]; Files.Write(out, ch); INC(i) UNTIL ch = 0X;
  56. ASSERT(i < len);
  57. WHILE i < len DO Files.Write(out, 0X); INC(i) END;
  58. END WriteStringFix;
  59. PROCEDURE Do (VAR R, out: Files.Rider; face: ARRAY OF CHAR; size: INTEGER; style: INTEGER; res: INTEGER);
  60. CONST
  61. True = 1X; False = 0X;
  62. TYPE
  63. RunRec = RECORD beg, end: INTEGER END;
  64. BoxRec = RECORD dx, x, y, w, h: INTEGER END;
  65. VAR
  66. height, minX, maxX, minY, maxY, maxDX: INTEGER;
  67. NofRuns, NofBoxes: INTEGER;
  68. i, j, k, l, m, n, r, dx, x, y, w, h: INTEGER;
  69. ascii: INTEGER;
  70. run: ARRAY 16 OF RunRec;
  71. box: ARRAY 256 OF BoxRec;
  72. ch, raster: CHAR;
  73. map: POINTER TO ARRAY OF ARRAY OF CHAR; (* raster font bitmap *)
  74. bitmapH: INTEGER; (* height of map in pixels *)
  75. bitmapW: INTEGER; (* width of map in bytes *)
  76. bitmapX: INTEGER; (* current offset in map from left, in bytes *)
  77. charW: INTEGER;
  78. bitY, bitX: INTEGER;
  79. fix: Files.Rider;
  80. FaceFixup1, FaceFixup2, FONTSizeFixup1, FONTSizeFixup2, BitsFixup, mapPos: LONGINT;
  81. FontDirStartFix, FontStartFixup: LONGINT;
  82. FontDirStart, FontDirEnd: LONGINT; (* start and end of FONTDIR resource *)
  83. FontStart, FontEnd: LONGINT; (* start and end of FONT resource *)
  84. s: ARRAY 128 OF CHAR;
  85. BEGIN
  86. Info.version := 200H; (* Version 2.0 *)
  87. Info.copyright := "Copyright (c) ETH Zuerich, Switzerland";
  88. Info.type := 0;
  89. Info.device := 0;
  90. Info.bitsPointer := 0;
  91. Files.Read(R, ch); Files.Read(R, ch); Files.Read(R, ch); (* abstraction, family, variant *)
  92. Files.ReadInt(R, height); (* line spacing *)
  93. Files.ReadInt(R, minX); Files.ReadInt(R, maxX);
  94. Files.ReadInt(R, minY); Files.ReadInt(R, maxY);
  95. bitmapH := maxY - minY;
  96. Info.points := size;
  97. Info.vertRes := res; Info.horizRes := res;
  98. Info.ascent := maxY;
  99. Info.internalLeading := 0;
  100. Info.externalLeading := 0 (*height - (maxY - minY)*);
  101. IF style = italic THEN Info.italic := True ELSE Info.italic := False END;
  102. Info.underline := False;
  103. Info.strikeOut := False;
  104. IF style = bold THEN Info.weight := 700
  105. ELSIF style = medium THEN Info.weight := 600
  106. ELSE Info.weight := 400
  107. END;
  108. Info.charSet := 0X; (* ANSI_CHARSET *)
  109. Info.pixWidth := 0; (* proportional raster font *)
  110. Info.pixHeight := bitmapH; (* height of map *)
  111. Info.pitchAndFamily := CHR(1 (* variable pitch *) + 0 (* FF_DONTCARE *));
  112. k := 0;
  113. WHILE k < 257 DO CharTab[k].width := 0; CharTab[k].offs := 0; INC(k) END;
  114. Files.ReadInt(R, NofRuns);
  115. NofBoxes := 0; r := 0;
  116. WHILE r # NofRuns DO
  117. Files.ReadInt(R, run[r].beg); Files.ReadInt(R, run[r].end);
  118. NofBoxes := NofBoxes + run[r].end - run[r].beg;
  119. INC(r)
  120. END;
  121. Info.firstChar := 0X;
  122. Info.lastChar := 0FFX;
  123. Info.defaultChar := SPC;
  124. Info.breakChar := SPC;
  125. l := 0;
  126. maxDX := MIN(INTEGER); bitmapW := 0;
  127. WHILE l # NofBoxes DO
  128. Files.ReadInt(R, dx); box[l].dx := dx;
  129. IF maxDX < dx THEN maxDX := dx END;
  130. bitmapW := bitmapW + (dx + 7) DIV 8;
  131. Files.ReadInt(R, box[l].x); Files.ReadInt(R, box[l].y);
  132. Files.ReadInt(R, box[l].w); Files.ReadInt(R, box[l].h);
  133. INC(l)
  134. END;
  135. bitmapW := bitmapW +1 (*dummy character CharTab[256]*) + (-bitmapW) MOD 2; (* bitmap width must be even *)
  136. Info.widthBytes := bitmapW;
  137. Info.maxWidth := maxDX;
  138. Info.avgWidth := Info.maxWidth; (* patched with width of letter X later *)
  139. NEW(map, bitmapH, bitmapW);
  140. FOR i := 0 TO bitmapH - 1 DO
  141. FOR j := 0 TO bitmapW - 1 DO map[i, j] := 0X END;
  142. END;
  143. r := 0; l := 0; m := 0; bitmapX := 0; ascii := 0;
  144. WHILE r < NofRuns DO
  145. m := run[r].beg;
  146. (* fill in the gap between runs *)
  147. WHILE ascii < m DO
  148. CharTab[ascii].width := 0; CharTab[ascii].offs := bitmapX * bitmapH; INC(ascii)
  149. END;
  150. WHILE m < run[r].end DO
  151. dx := box[l].dx; x := box[l].x; y := box[l].y; w := box[l].w; h := box[l].h;
  152. CharTab[ascii].width := dx;
  153. IF ascii = ORD("X") THEN Info.avgWidth := dx END;
  154. CharTab[ascii].offs := bitmapX * bitmapH;
  155. charW := (dx + 7) DIV 8; (* width of Windows character box in bytes *)
  156. i := 0; n := (w + 7) DIV 8;
  157. WHILE i < h DO j := 0;
  158. bitY := bitmapH - (-minY + y + i) - 1; (* y coord of bit in Windows character box *)
  159. WHILE j < n DO
  160. Files.Read(R, raster);
  161. k := 0;
  162. WHILE k < 8 DO
  163. IF (j*8 + k) < w THEN
  164. IF ODD(ORD(raster) DIV PowTwo[k]) THEN (* bit k is set *)
  165. bitX := -minX + x + j*8 + k; (* x coord of bit in Windows character box *)
  166. ch := map[bitY, bitmapX + (bitX DIV 8)];
  167. ch := CHR(ORD(ch) + PowTwo[7 - (bitX MOD 8)]);
  168. map[bitY, bitmapX + (bitX DIV 8)] := ch;
  169. END;
  170. END;
  171. INC(k);
  172. END;
  173. INC(j);
  174. END;
  175. INC(i);
  176. END;
  177. INC(bitmapX, charW);
  178. INC(l); INC(m); INC(ascii);
  179. END;
  180. INC(r)
  181. END;
  182. WHILE ascii < 256 DO
  183. CharTab[ascii].width := 0; CharTab[ascii].offs := bitmapX*bitmapH; INC(ascii)
  184. END;
  185. CharTab[256].width := 8; CharTab[256].offs := (bitmapW-1)*bitmapH; (* dummy entry *)
  186. (* Write FON file *)
  187. (* DOS Stub and New Executable header *)
  188. FOR i := 0 TO 47 DO Files.WriteLInt(out, C[i]) END;
  189. (* Resource Table *)
  190. Files.WriteInt(out, 0004H); (* alignment *)
  191. Files.WriteInt(out, -32761 (*8007H*)); (* RT_FONTDIR *)
  192. Files.WriteInt(out, 0001H); (* 1 FONTDIR resource *)
  193. Files.WriteLInt(out, 0); (* 4 bytes reserved *)
  194. FontDirStartFix := Files.Pos(out); Files.WriteInt(out, 0000H); (* FONTDIR start, fixup later *)
  195. Files.WriteInt(out, 0000H); (* FONTDIR length, fixup later *)
  196. Files.WriteInt(out, 0C50H); (* flags *)
  197. Files.WriteInt(out, 002CH); (* offset to resource identifier *)
  198. Files.WriteLInt(out, 0); (* 4 bytes reserved *)
  199. Files.WriteInt(out, -32760 (*8008H*)); (* RT_FONT *)
  200. Files.WriteInt(out, 0001H); (* 1 FONT resource *)
  201. Files.WriteLInt(out, 0); (* 4 bytes reserved *)
  202. FontStartFixup := Files.Pos(out); Files.WriteInt(out, 0000H); (* FONT resource start, fixup later *)
  203. Files.WriteInt(out, 0000H); (* FONT length, fixup later *)
  204. Files.WriteInt(out, 1C30H); Files.WriteInt(out, -32767 (*8001H*)); (* flags, resource id *)
  205. Files.WriteLInt(out, 0); (* 4 bytes reserved *)
  206. Files.WriteInt(out, 000H); (* end of resource table *)
  207. Files.Write(out, 7); s := "FONTDIR"; Files.WriteBytes(out, s, 7);
  208. Files.Write(out, 7); s := "FONTRES"; Files.WriteBytes(out, s, 7);
  209. Files.WriteLInt(out, 0); (* 4 bytes reserved *)
  210. s := "'FONTRES 100,96,96 : ";
  211. Append(s, oname);
  212. WriteStringFix(out, s, 48);
  213. ASSERT (Files.Pos(out) MOD 16 = 0);
  214. (* FONTDIR resource *)
  215. FontDirStart := Files.Pos(out);
  216. Files.WriteInt(out, 0001); (* 1 resource *)
  217. Files.WriteInt(out, 0001); (* font no 1 follows *)
  218. Files.WriteInt(out, Info.version);
  219. FONTSizeFixup1 := Files.Pos(out);
  220. Files.WriteLInt(out, Info.size);
  221. WriteStringFix(out, Info.copyright, 60);
  222. Files.WriteInt(out, Info.type);
  223. Files.WriteInt(out, Info.points);
  224. Files.WriteInt(out, Info.vertRes);
  225. Files.WriteInt(out, Info.horizRes);
  226. Files.WriteInt(out, Info.ascent);
  227. Files.WriteInt(out, Info.internalLeading);
  228. Files.WriteInt(out, Info.externalLeading);
  229. Files.Write(out, Info.italic);
  230. Files.Write(out, Info.underline);
  231. Files.Write(out, Info.strikeOut);
  232. Files.WriteInt(out, Info.weight);
  233. Files.Write(out, Info.charSet);
  234. Files.WriteInt(out, Info.pixWidth);
  235. Files.WriteInt(out, Info.pixHeight);
  236. Files.Write(out, Info.pitchAndFamily);
  237. Files.WriteInt(out, Info.avgWidth);
  238. Files.WriteInt(out, Info.maxWidth);
  239. Files.Write(out, Info.firstChar);
  240. Files.Write(out, Info.lastChar);
  241. Files.Write(out, Info.defaultChar);
  242. Files.Write(out, Info.breakChar);
  243. Files.WriteInt(out, Info.widthBytes);
  244. Files.WriteLInt(out, Info.device);
  245. FaceFixup1 := Files.Pos(out); Files.WriteLInt(out, Info.face);
  246. Files.WriteLInt(out, 0); (* reserved *)
  247. Files.WriteString(out, "DISPLAY");
  248. i := 0; REPEAT Files.Write(out, face[i]); INC(i) UNTIL face[i] = 0X;
  249. WHILE Files.Pos(out) MOD 16 # 0 DO Files.Write(out, 0X) END; (* filler bytes *)
  250. FontDirEnd := Files.Pos(out);
  251. ASSERT ((FontDirEnd - FontDirStart) MOD 16 = 0);
  252. (* FONT resource *)
  253. FontStart := Files.Pos(out);
  254. Files.WriteInt(out, Info.version);
  255. FONTSizeFixup2 := Files.Pos(out);
  256. Files.WriteLInt(out, Info.size);
  257. WriteStringFix(out, Info.copyright, 60);
  258. Files.WriteInt(out, Info.type);
  259. Files.WriteInt(out, Info.points);
  260. Files.WriteInt(out, Info.vertRes);
  261. Files.WriteInt(out, Info.horizRes);
  262. Files.WriteInt(out, Info.ascent);
  263. Files.WriteInt(out, Info.internalLeading);
  264. Files.WriteInt(out, Info.externalLeading);
  265. Files.Write(out, Info.italic);
  266. Files.Write(out, Info.underline);
  267. Files.Write(out, Info.strikeOut);
  268. Files.WriteInt(out, Info.weight);
  269. Files.Write(out, Info.charSet);
  270. Files.WriteInt(out, Info.pixWidth);
  271. Files.WriteInt(out, Info.pixHeight);
  272. Files.Write(out, Info.pitchAndFamily);
  273. Files.WriteInt(out, Info.avgWidth);
  274. Files.WriteInt(out, Info.maxWidth);
  275. Files.Write(out, Info.firstChar);
  276. Files.Write(out, Info.lastChar);
  277. Files.Write(out, Info.defaultChar);
  278. Files.Write(out, Info.breakChar);
  279. Files.WriteInt(out, Info.widthBytes);
  280. Files.WriteLInt(out, Info.device);
  281. FaceFixup2 := Files.Pos(out); Files.WriteLInt(out, Info.face);
  282. Files.WriteLInt(out, Info.bitsPointer);
  283. BitsFixup := Files.Pos(out);
  284. Files.WriteLInt(out, Info.bitsOffset);
  285. Files.Write(out, Info.res);
  286. mapPos := Files.Pos(out) - FontStart + 257*SIZEOF(CharEntry);
  287. FOR i := 0 TO 256 DO
  288. Files.WriteInt(out, CharTab[i].width);
  289. Files.WriteInt(out, SHORT(CharTab[i].offs + mapPos));
  290. END;
  291. (* character bitmaps *)
  292. Files.Set(fix, Files.Base(out), BitsFixup); Files.WriteLInt(fix, Files.Pos(out) - FontStart);
  293. FOR i := 0 TO Info.widthBytes - 1 DO
  294. FOR j := 0 TO Info.pixHeight - 1 DO
  295. Files.Write(out, map[j, i])
  296. END;
  297. END;
  298. Files.Set(fix, Files.Base(out), FaceFixup1); Files.WriteLInt(fix, Files.Pos(out)-FontStart);
  299. Files.Set(fix, Files.Base(out), FaceFixup2); Files.WriteLInt(fix, Files.Pos(out)-FontStart);
  300. i := 0; REPEAT Files.Write(out, face[i]); INC(i) UNTIL face[i] = 0X;
  301. Files.Write(out, 0X);
  302. Files.Set(fix, Files.Base(out), FONTSizeFixup1); Files.WriteLInt(fix, Files.Pos(out)-FontStart);
  303. Files.Set(fix, Files.Base(out), FONTSizeFixup2); Files.WriteLInt(fix, Files.Pos(out)-FontStart);
  304. WHILE Files.Pos(out) MOD 16 # 0 DO Files.Write(out, 0X) END; (* filler bytes *)
  305. FontEnd := Files.Pos(out);
  306. (* fixups in resource table *)
  307. Files.Set(fix, Files.Base(out), FontDirStartFix);
  308. Files.WriteInt(fix, SHORT(FontDirStart DIV 16)); Files.WriteInt(fix, SHORT((FontDirEnd - FontDirStart) DIV 16));
  309. Files.Set(fix, Files.Base(out), FontStartFixup);
  310. Files.WriteInt(fix, SHORT(FontStart DIV 16)); Files.WriteInt(fix, SHORT((FontEnd - FontStart) DIV 16));
  311. END Do;
  312. PROCEDURE ParseName (VAR name, faceName: ARRAY OF CHAR; VAR res, size, style: INTEGER);
  313. VAR i, j: INTEGER; fonttype: ARRAY 6 OF CHAR;
  314. BEGIN
  315. (* face name in Windows raster font is Oberon font name *)
  316. COPY(name, faceName);
  317. i := 0;
  318. WHILE ("A" <= CAP(name[i])) & (CAP(name[i]) <= "Z") DO INC(i) END;
  319. size := 0;
  320. IF ("0" <= name[i]) & (name[i] <= "9") THEN
  321. size := ORD(name[i]) - ORD("0"); INC(i);
  322. IF ("0" <= name[i]) & (name[i] <= "9") THEN
  323. size := 10*size + ORD(name[i]) - ORD("0"); INC(i);
  324. END;
  325. END;
  326. style := normal;
  327. IF ("A" <= CAP(name[i])) & (CAP(name[i]) <= "Z") THEN
  328. CASE CAP(name[i]) OF
  329. | "I": style := italic;
  330. | "B": style := bold;
  331. | "M": style := medium;
  332. ELSE style := normal;
  333. END;
  334. INC(i);
  335. END;
  336. j := 0;
  337. WHILE j < 4 DO fonttype[j] := name[i]; INC(j); INC(i) END;
  338. fonttype[4] := 0X; res := 96
  339. END ParseName;
  340. PROCEDURE Convert*; (** { OberonFontFile => [Path]WindowsFontFile } ~ **)
  341. VAR F, f: Files.File; R, r: Files.Rider;
  342. size, res, style: INTEGER; ch: CHAR;
  343. face, wname: ARRAY 64 OF CHAR;
  344. S: Texts.Scanner; text: Texts.Text; beg, end, time: LONGINT;
  345. BEGIN
  346. Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S);
  347. IF (S.class = Texts.Char) & (S.c = "^") THEN
  348. Oberon.GetSelection(text, beg, end, time);
  349. IF time > 0 THEN Texts.OpenScanner(S, text, beg); Texts.Scan(S) END;
  350. END;
  351. LOOP
  352. IF S.class # Texts.Name THEN EXIT END;
  353. COPY(S.s, oname);
  354. Texts.Scan(S); IF (S.class # Texts.Char) OR (S.c # "=") THEN EXIT END;
  355. Texts.Scan(S); IF (S.class # Texts.Char) OR (S.c # ">") THEN EXIT END;
  356. Texts.Scan(S); IF S.class # Texts.Name THEN EXIT END;
  357. COPY(S.s, wname);
  358. ParseName(oname, face, res, size, style);
  359. Out.String(face);
  360. F := Files.Old(oname);
  361. IF F # NIL THEN
  362. Files.Set(R, F, 0); Files.Read(R, ch);
  363. IF ch = FontFileId THEN
  364. f := Files.New(wname);
  365. IF f # NIL THEN
  366. Out.String(" => ");
  367. Files.Set(r, f, 0);
  368. Do(R, r, face, size, style, res);
  369. Files.Register(f);
  370. Out.String(wname); Out.Ln;
  371. END
  372. ELSE
  373. Out.String(" not a font"); Out.Ln;
  374. END;
  375. Files.Close(F)
  376. ELSE
  377. Out.String(" not found"); Out.Ln;
  378. END;
  379. Texts.Scan(S)
  380. END
  381. END Convert;
  382. PROCEDURE SetUnsigned(VAR dest: LONGINT; src: HUGEINT);
  383. BEGIN
  384. dest := SHORT(src);
  385. END SetUnsigned;
  386. PROCEDURE Init;
  387. BEGIN
  388. SetUnsigned(C[0] , 0F75A4DH); SetUnsigned(C[1] , 1); SetUnsigned(C[2] , 4); SetUnsigned(C[3] , 0FFFFH);
  389. SetUnsigned(C[4] , 0B8H); SetUnsigned(C[5] , 0); SetUnsigned(C[6] , 40H); SetUnsigned(C[7] , 0);
  390. SetUnsigned(C[8] , 0); SetUnsigned(C[9] , 0); SetUnsigned(C[10] , 0); SetUnsigned(C[11] , 0);
  391. SetUnsigned(C[12] , 0); SetUnsigned(C[13] , 0); SetUnsigned(C[14] , 0); SetUnsigned(C[15] , 80H);
  392. SetUnsigned(C[16] , 0EBA1F0EH); SetUnsigned(C[17] , 0CD09B400H); SetUnsigned(C[18] , 4C01B821H); SetUnsigned(C[19] , 685421CDH);
  393. SetUnsigned(C[20] , 70207369H); SetUnsigned(C[21] , 72676F72H); SetUnsigned(C[22] , 72206D61H); SetUnsigned(C[23] , 69757165H);
  394. SetUnsigned(C[24] , 20736572H); SetUnsigned(C[25] , 7263694DH); SetUnsigned(C[26] , 666F736FH); SetUnsigned(C[27] , 69572074H);
  395. SetUnsigned(C[28] , 776F646EH); SetUnsigned(C[29] , 0A0D2E73H); SetUnsigned(C[30] , 24H); SetUnsigned(C[31] , 0);
  396. SetUnsigned(C[32] , 3205454EH); SetUnsigned(C[33] , 01007FH); SetUnsigned(C[34] , 0); SetUnsigned(C[35] , 8300H);
  397. SetUnsigned(C[36] , 0); SetUnsigned(C[37] , 0); SetUnsigned(C[38] , 0); SetUnsigned(C[39] , 0);
  398. SetUnsigned(C[40] , 40002BH); SetUnsigned(C[41] , 740040H); SetUnsigned(C[42] , 7F007FH); SetUnsigned(C[43] , 0100H);
  399. SetUnsigned(C[44] , 040000H); SetUnsigned(C[45] , 020000H); SetUnsigned(C[46] , 0); SetUnsigned(C[47] , 030A0000H);
  400. END Init;
  401. BEGIN Init;
  402. Out.String("Oberon to Windows Font Conversion Utility "); Out.String(Version); Out.Ln;
  403. PowTwo[0] := 1; PowTwo[1] := 2; PowTwo[2] := 4; PowTwo[3] := 8;
  404. PowTwo[4] := 16; PowTwo[5] := 32; PowTwo[6] := 64; PowTwo[7] := 128; PowTwo[8] := 256;
  405. END FontRes.
  406. FontRes.Convert
  407. Converts an Oberon screen font to a Windows FON resource that is used by Oberon for Windows to speed up text output. The Windows .FNT file format used to produce the resource is documented in the Microsoft Windows Programmer's Reference, Vol. 4, Chapter 4: Font File Format.
  408. Syntax:
  409. FontRes.Convert { OberonFontFile => [Path]WindowsFontFile } ~
  410. Example:
  411. FontRes.Convert Syntax10.Scn.Fnt => &SYNTA10.FON ~
  412. Naming Convention:
  413. The name of a FON file consists of 4 parts:
  414. NNNNNSSF.FON
  415. where
  416. NNNNN first five letters of font family name (e.g. Synta for Syntax, Math for Math)
  417. SS maximum two digits for font size
  418. F optional character for face style (b = bold, i = italics, m = medium)
  419. .FON standard name extension
  420. This naming convention is hard-coded into module Fonts. It allows module Fonts to search for Windows font
  421. resources belonging to an Oberon font.
  422. System.ChangeDirectory Fonts ~
  423. FontRes.Convert
  424. Courier8.Scn.Fnt => COURI8.FON
  425. Courier10.Scn.Fnt => COURI10.FON
  426. Courier12.Scn.Fnt => COURI12.FON
  427. Math10.Scn.Fnt => MATH10.FON
  428. Math12.Scn.Fnt => MATH12.FON
  429. Math14.Scn.Fnt => MATH14.FON
  430. Math16.Scn.Fnt => MATH16.FON
  431. Math20.Scn.Fnt => MATH20.FON
  432. Math24.Scn.Fnt => MATH24.FON
  433. Greek10.Scn.Fnt => GREEK10.FON
  434. Greek12.Scn.Fnt => GREEK12.FON
  435. Greek14.Scn.Fnt => GREEK14.FON
  436. Greek16.Scn.Fnt => GREEK16.FON
  437. Greek20.Scn.Fnt => GREEK20.FON
  438. Greek24.Scn.Fnt => GREEK24.FON
  439. Oberon8.Scn.Fnt => OBERO8.FON
  440. Oberon8b.Scn.Fnt => OBERO8B.FON
  441. Oberon8i.Scn.Fnt => OBERO8I.FON
  442. Oberon10.Scn.Fnt => OBERO10.FON
  443. Oberon10b.Scn.Fnt => OBERO10B.FON
  444. Oberon10i.Scn.Fnt => OBERO10I.FON
  445. Oberon12.Scn.Fnt => OBERO12.FON
  446. Oberon12b.Scn.Fnt => OBERO12B.FON
  447. Oberon12i.Scn.Fnt => OBERO12I.FON
  448. Oberon14.Scn.Fnt => OBERO14.FON
  449. Oberon14b.Scn.Fnt => OBERO14B.FON
  450. Oberon14i.Scn.Fnt => OBERO14I.FON
  451. Oberon16.Scn.Fnt => OBERO16.FON
  452. Oberon16b.Scn.Fnt => OBERO16B.FON
  453. Oberon16i.Scn.Fnt => OBERO16I.FON
  454. Oberon20.Scn.Fnt => OBERO20.FON
  455. Oberon20b.Scn.Fnt => OBERO20B.FON
  456. Oberon20i.Scn.Fnt => OBERO20I.FON
  457. Oberon24.Scn.Fnt => OBERO24.FON
  458. Oberon24b.Scn.Fnt => OBERO24B.FON
  459. Oberon24i.Scn.Fnt => OBERO24I.FON
  460. Syntax8.Scn.Fnt => SYNTA8.FON
  461. Syntax8b.Scn.Fnt => SYNTA8B.FON
  462. Syntax8i.Scn.Fnt => SYNTA8I.FON
  463. Syntax8m.Scn.Fnt => SYNTA8M.FON
  464. Syntax10.Scn.Fnt => SYNTA10.FON
  465. Syntax10b.Scn.Fnt => SYNTA10B.FON
  466. Syntax10i.Scn.Fnt => SYNTA10I.FON
  467. Syntax10m.Scn.Fnt => SYNTA10M.FON
  468. Syntax12.Scn.Fnt => SYNTA12.FON
  469. Syntax12b.Scn.Fnt => SYNTA12B.FON
  470. Syntax12i.Scn.Fnt => SYNTA12I.FON
  471. Syntax12m.Scn.Fnt => SYNTA12M.FON
  472. Syntax14.Scn.Fnt => SYNTA14.FON
  473. Syntax14b.Scn.Fnt => SYNTA14B.FON
  474. Syntax14i.Scn.Fnt => SYNTA14I.FON
  475. Syntax14m.Scn.Fnt => SYNTA14M.FON
  476. Syntax16.Scn.Fnt => SYNTA16.FON
  477. Syntax16b.Scn.Fnt => SYNTA16B.FON
  478. Syntax16i.Scn.Fnt => SYNTA16I.FON
  479. Syntax16m.Scn.Fnt => SYNTA16M.FON
  480. Syntax20.Scn.Fnt => SYNTA20.FON
  481. Syntax20b.Scn.Fnt => SYNTA20B.FON
  482. Syntax20i.Scn.Fnt => SYNTA20I.FON
  483. Syntax20m.Scn.Fnt => SYNTA20M.FON
  484. Syntax24.Scn.Fnt => SYNTA24.FON
  485. Syntax24b.Scn.Fnt => SYNTA24B.FON
  486. Syntax24i.Scn.Fnt => SYNTA24I.FON
  487. Syntax24m.Scn.Fnt => SYNTA24M.FON ~