Selaa lähdekoodia

Allow TrueType fonts to be used in Oberon texts. When documents containig
TrueType fonts get opened in the Oberon subsystem the needed Oberon
fonts are created on the fly. To enable storing texts with TTF fonts perform
the command OberonFonts.Install (Configuration.XML).

Filename conventions for the TrueType fonts to be used this way:
- Fontname.ttf (normal)
- Fontname_bd.ttf (bold)
- Fontname_i.ttf (italic)


git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7606 8c9fc860-2736-0410-a75d-ab315db34111

eth.guenter 7 vuotta sitten
vanhempi
commit
8c86b52a44
3 muutettua tiedostoa jossa 13 lisäystä ja 2 poistoa
  1. BIN
      source/Oberon.Fonts.Mod
  2. 1 0
      source/Release.Tool
  3. 12 2
      source/TextUtilities.Mod

BIN
source/Oberon.Fonts.Mod


+ 1 - 0
source/Release.Tool

@@ -992,6 +992,7 @@ PACKAGE GuiApplicationsMini ARCHIVE "GuiApplicationsMini.zip" SOURCE "GuiApplica
 
 
 	WMDefaultFont.Mod WMFontManager.Mod WMOberonFonts.Mod WMCCGFonts.Mod WMBitmapFont.Mod	# Font support
 	WMDefaultFont.Mod WMFontManager.Mod WMOberonFonts.Mod WMCCGFonts.Mod WMBitmapFont.Mod	# Font support
 	OpenTypeInt.Mod OpenTypeScan.Mod OpenType.Mod OpenTypeFonts.Mod  WMOTFonts.Mod	# OpenType Fonts
 	OpenTypeInt.Mod OpenTypeScan.Mod OpenType.Mod OpenTypeFonts.Mod  WMOTFonts.Mod	# OpenType Fonts
+	OberonFonts.Mod # OpenType Fonts to Oberon Fonts
 
 
 	cjkfont.bfnt # since used as fallback
 	cjkfont.bfnt # since used as fallback
 
 

+ 12 - 2
source/TextUtilities.Mod

@@ -1562,6 +1562,8 @@ TYPE
 
 
 VAR
 VAR
 	unicodePropertyReader : UnicodeProperties.UnicodeTxtReader;
 	unicodePropertyReader : UnicodeProperties.UnicodeTxtReader;
+	
+	oberonFontAllocatable*: PROCEDURE( CONST name: ARRAY OF CHAR ): BOOLEAN;
 
 
 (* ----------------------------------------------------------------------------------- *)
 (* ----------------------------------------------------------------------------------- *)
 (* Return true if the unicode character x should be regarded as a white-space *)
 (* Return true if the unicode character x should be regarded as a white-space *)
@@ -2030,14 +2032,21 @@ BEGIN
 END DecodeOberonFontName;
 END DecodeOberonFontName;
 
 
 PROCEDURE ToOberonFont(CONST name : ARRAY OF CHAR; size : LONGINT; style : SET; VAR oname : ARRAY OF CHAR) : BOOLEAN;
 PROCEDURE ToOberonFont(CONST name : ARRAY OF CHAR; size : LONGINT; style : SET; VAR oname : ARRAY OF CHAR) : BOOLEAN;
-VAR str : ARRAY 32 OF CHAR;
+VAR str : ARRAY 32 OF CHAR; f: Files.File;
 BEGIN
 BEGIN
 	COPY(name, oname);
 	COPY(name, oname);
 	Strings.IntToStr(size, str); Strings.Append(oname, str);
 	Strings.IntToStr(size, str); Strings.Append(oname, str);
 	IF WMGraphics.FontBold IN style THEN Strings.Append(oname, "b") END;
 	IF WMGraphics.FontBold IN style THEN Strings.Append(oname, "b") END;
 	IF WMGraphics.FontItalic IN style THEN Strings.Append(oname, "i") END;
 	IF WMGraphics.FontItalic IN style THEN Strings.Append(oname, "i") END;
 	Strings.Append(oname, ".Scn.Fnt");
 	Strings.Append(oname, ".Scn.Fnt");
-	RETURN Files.Old(oname) # NIL
+	f := Files.Old(oname);
+	IF f # NIL THEN  RETURN TRUE
+	ELSE
+		IF oberonFontAllocatable # NIL THEN
+			RETURN oberonFontAllocatable(oname)
+		END;
+		RETURN FALSE
+	END
 END ToOberonFont;
 END ToOberonFont;
 
 
 PROCEDURE GetUTF8Char*(r : Streams.Reader; VAR u : Texts.Char32) : BOOLEAN;
 PROCEDURE GetUTF8Char*(r : Streams.Reader; VAR u : Texts.Char32) : BOOLEAN;
@@ -2567,6 +2576,7 @@ BEGIN
 END GetDefaultAttributes;
 END GetDefaultAttributes;
 
 
 BEGIN
 BEGIN
+	oberonFontAllocatable := NIL;
 	GetConfig;
 	GetConfig;
 END TextUtilities.
 END TextUtilities.