Ver Fonte

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 há 7 anos atrás
pai
commit
8c86b52a44
3 ficheiros alterados com 13 adições e 2 exclusões
  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
 	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
 

+ 12 - 2
source/TextUtilities.Mod

@@ -1562,6 +1562,8 @@ TYPE
 
 VAR
 	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 *)
@@ -2030,14 +2032,21 @@ BEGIN
 END DecodeOberonFontName;
 
 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
 	COPY(name, oname);
 	Strings.IntToStr(size, str); Strings.Append(oname, str);
 	IF WMGraphics.FontBold IN style THEN Strings.Append(oname, "b") END;
 	IF WMGraphics.FontItalic IN style THEN Strings.Append(oname, "i") END;
 	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;
 
 PROCEDURE GetUTF8Char*(r : Streams.Reader; VAR u : Texts.Char32) : BOOLEAN;
@@ -2567,6 +2576,7 @@ BEGIN
 END GetDefaultAttributes;
 
 BEGIN
+	oberonFontAllocatable := NIL;
 	GetConfig;
 END TextUtilities.