WinWorkstation.st
changeset 2929 a0aa21f89019
parent 2928 ada074408fad
child 2930 6b6db22e2259
--- a/WinWorkstation.st	Sun Sep 26 15:39:44 1999 +0200
+++ b/WinWorkstation.st	Sun Sep 26 15:58:26 1999 +0200
@@ -4239,15 +4239,15 @@
 	    } else {
 		if( lplf->lfUnderline == TRUE ) {
 		    if( lplf->lfStrikeOut == TRUE ) {
-			s = "underline-strikeOut";
+			s = "roman-underline-strikeOut";
 		    } else {
-			s = "underline";
+			s = "roman-underline";
 		    }
 		} else {
 		    if( lplf->lfStrikeOut == TRUE ) {
-			s = "strikeOut";
+			s = "roman-strikeOut";
 		    } else {
-			s = "normal";
+			s = "roman";
 		    }
 		}
 	    }
@@ -10134,7 +10134,7 @@
 	    getFontWithFoundry:'*'
 	    family:familyString asLowercase
 	    weight:faceString
-	    slant:xlatedStyle
+	    slant:styleString "/ xlatedStyle
 	    spacing:spacing
 	    pixelSize:nil
 	    size:sizeArg
@@ -10144,13 +10144,12 @@
     id isNil ifTrue:[
 	(encodingSym notNil and:[encodingSym ~= '*']) ifTrue:[
 	    "/ too stupid: encodings come in both cases
-	    "/ and X does not ignore case
 	    "/
 	    id := self
 		    getFontWithFoundry:'*'
 		    family:familyString asLowercase
 		    weight:faceString
-		    slant:xlatedStyle
+		    slant:styleString "/ xlatedStyle
 		    spacing:spacing
 		    pixelSize:nil
 		    size:sizeArg
@@ -10161,12 +10160,25 @@
 			getFontWithFoundry:'*'
 			family:familyString asLowercase
 			weight:faceString
-			slant:xlatedStyle
+			slant:styleString "/ xlatedStyle
 			spacing:spacing
 			pixelSize:nil
 			size:sizeArg
 			registry:encodingSym asLowercase
 			encoding:'*'.
+
+		id isNil ifTrue:[
+		    id := self
+			    getFontWithFoundry:'*'
+			    family:familyString asLowercase
+			    weight:faceString asLowercase
+			    slant:styleString asLowercase
+			    spacing:spacing
+			    pixelSize:nil
+			    size:sizeArg
+			    registry:encodingSym asLowercase
+			    encoding:'*'.
+		]
 	    ]
 	]
     ].
@@ -10177,8 +10189,8 @@
 !
 
 getFontWithFoundry:foundry family:family weight:weight
-              slant:slant spacing:spc pixelSize:pSize size:size
-              registry:registry encoding:encoding
+	      slant:slant spacing:spc pixelSize:pSize size:size
+	      registry:registry encoding:encoding
 
     "get the specified font, if not available, return nil.
      For now, this is a poor (incomplete) emulation of the X code ...
@@ -10198,35 +10210,35 @@
     "
      Windows-NT/95 allows the creation of a font with the following parameters
 
-        nHeight
-        nWidth
-        nEscapement
-        nOrientation
-        fnWeight        FW_DONTCARE, FW_NORMAL, FW_MEDIUM, FW_BOLD, ...
-        fdwItalic       TRUE or FALSE
-        fdwUnderline    TRUE or FALSE
-        fdwStrikeOut    TRUE or FALSE
-        fdwCharSet      ANSI_CHARSET, UNICODE_, SYMBOL_, SHIFTJIS_,...
-        fdwOutputPrecision      DEFAULT, STRING, CHAR, ...
-        fdwClipPrecision        DEFAULT, CHAR, STROKE, MASK, ...
-        fdwQuality      DEFAULT, DRAFT, or PROOF.
-        fdwPitchAndFamily
-                DEFAULT, FIXED or VARIABLE pitch
-                DECORATIVE, DONTCASE, MODERN, ROMAN, SCRIPT, or SWISS.
-        lpszFace
-                Typeface Name
+	nHeight
+	nWidth
+	nEscapement
+	nOrientation
+	fnWeight        FW_DONTCARE, FW_NORMAL, FW_MEDIUM, FW_BOLD, ...
+	fdwItalic       TRUE or FALSE
+	fdwUnderline    TRUE or FALSE
+	fdwStrikeOut    TRUE or FALSE
+	fdwCharSet      ANSI_CHARSET, UNICODE_, SYMBOL_, SHIFTJIS_,...
+	fdwOutputPrecision      DEFAULT, STRING, CHAR, ...
+	fdwClipPrecision        DEFAULT, CHAR, STROKE, MASK, ...
+	fdwQuality      DEFAULT, DRAFT, or PROOF.
+	fdwPitchAndFamily
+		DEFAULT, FIXED or VARIABLE pitch
+		DECORATIVE, DONTCASE, MODERN, ROMAN, SCRIPT, or SWISS.
+	lpszFace
+		Typeface Name
 
       These two above descriptions will be matched as follows:
 
-        foundry   - ignored
-        family    - mapped to type face name.
-        weight    - mapped to fnWeight
-        slant     - used for style
-        spacing   - NOT USED INITIALLY
-        pixelSize - NOT USED INITIALLY
-        size      - mapped to nHeight
-        registry  - NOT USED INITIALLY
-        encoding  - NOT USED INITIALLY used for dwType device, raster or truetype
+	foundry   - ignored
+	family    - mapped to type face name.
+	weight    - mapped to fnWeight
+	slant     - used for style
+	spacing   - NOT USED INITIALLY
+	pixelSize - NOT USED INITIALLY
+	size      - mapped to nHeight
+	registry  - NOT USED INITIALLY
+	encoding  - NOT USED INITIALLY used for dwType device, raster or truetype
      "
 
 %{ 
@@ -10266,81 +10278,81 @@
 
 /* SET VALUES */
     if ( __isString( family ) ) {
-        work = __stringVal( family );
-        if (strcmp( work, "nil" ) != 0 ) {
-            strncpy( (char *)lpszFace, work, 32 );
-        }
+	work = __stringVal( family );
+	if (strcmp( work, "nil" ) != 0 ) {
+	    strncpy( (char *)lpszFace, work, 32 );
+	}
     }
 
     fnWeight = FW_MEDIUM;
     if( __isString( weight ) ) {
-        work = __stringVal( weight );
-        if (strcmp( work, "bold" ) == 0 ) {
-            fnWeight = FW_BOLD;
-        } else {
-            if (strcmp( work, "medium" ) == 0 ) {
-                fnWeight = FW_MEDIUM;
-            } else {
-                if (strcmp( work, "demi" ) == 0 )
-                    fnWeight = FW_LIGHT;
-            }
-        }
+	work = __stringVal( weight );
+	if (strcmp( work, "bold" ) == 0 ) {
+	    fnWeight = FW_BOLD;
+	} else {
+	    if (strcmp( work, "medium" ) == 0 ) {
+		fnWeight = FW_MEDIUM;
+	    } else {
+		if (strcmp( work, "demi" ) == 0 )
+		    fnWeight = FW_LIGHT;
+	    }
+	}
     }
 
     if(__isSmallInteger( size )) {
-        nHeight = __intVal( size );
+	nHeight = __intVal( size );
     }
 
     if (__isString(slant)) {
-        work2 = __stringVal( slant );
-        work  = __stringVal( slant );
-
-        if (strncmp(work2, "italic", 6) == 0)  {
-            fdwItalic = TRUE;
-            if ( work2[6] = '-' )
-                strncpy( work, &work2[7], ( strlen( work2) - 7) );
-        } else {
-            if (strncmp(work2, "oblique", 7) == 0)  {
-                fdwItalic = TRUE;
-                if ( work2[7] = '-' )
-                    strncpy( work, &work2[8], ( strlen( work2) - 8) );
-            }
-        }
-        if (strncmp( work, "underline", 9 ) == 0 ) {
-            fdwUnderline = TRUE;
-            if( work[10] == '-' )
-                strncpy( work2, &work[11], ( strlen( work ) - 10 ) );
-        }
-        if (strncmp( work2, "strikeOut", 9 ) == 0 ) {
-            fdwStrikeOut = TRUE;
-        }
+	work2 = __stringVal( slant );
+	work  = __stringVal( slant );
+
+	if (strncmp(work2, "italic", 6) == 0)  {
+	    fdwItalic = TRUE;
+	    if ( work2[6] = '-' )
+		strncpy( work, &work2[7], ( strlen( work2) - 7) );
+	} else {
+	    if (strncmp(work2, "oblique", 7) == 0)  {
+		fdwItalic = TRUE;
+		if ( work2[7] = '-' )
+		    strncpy( work, &work2[8], ( strlen( work2) - 8) );
+	    }
+	}
+	if (strncmp( work, "underline", 9 ) == 0 ) {
+	    fdwUnderline = TRUE;
+	    if( work[10] == '-' )
+		strncpy( work2, &work[11], ( strlen( work ) - 10 ) );
+	}
+	if (strncmp( work2, "strikeOut", 9 ) == 0 ) {
+	    fdwStrikeOut = TRUE;
+	}
     }
 
     nHeight = -MulDiv(nHeight, __logPixelSY, 72);
 
     DPRINTF(("CreateFont face:%s h=%d\n", lpszFace, nHeight));
     hFont = CreateFont( nHeight,
-                        nWidth,
-                        nEscapement,
-                        nOrientation,
-                        fnWeight,
-                        fdwItalic,
-                        fdwUnderline,
-                        fdwStrikeOut,
-                        fdwCharSet,
-                        fdwOutputPrecision,
-                        fdwClipPrecision,
-                        fdwQuality,
-                        fdwPitchAndFamily,
-                        lpszFace );
+			nWidth,
+			nEscapement,
+			nOrientation,
+			fnWeight,
+			fdwItalic,
+			fdwUnderline,
+			fdwStrikeOut,
+			fdwCharSet,
+			fdwOutputPrecision,
+			fdwClipPrecision,
+			fdwQuality,
+			fdwPitchAndFamily,
+			lpszFace );
 
     if (hFont != NULL) {
-        DPRINTF(("createFont: %x\n", hFont));
+	DPRINTF(("createFont: %x\n", hFont));
 #ifdef COUNT_RESOURCES
-        __cnt_font++;
-        RES1PRINTF(("CreateFont %d\n", __cnt_font));
-#endif
-        RETURN ( __MKOBJ(hFont) );
+	__cnt_font++;
+	RES1PRINTF(("CreateFont %d\n", __cnt_font));
+#endif
+	RETURN ( __MKOBJ(hFont) );
     }
 
     DPRINTF(("***** ERROR createFontWithFoundry failed ERROR *****\n" ));
@@ -10349,14 +10361,14 @@
 
     "
      Display getFontWithFoundry:'*'
-                         family:'courier'
-                         weight:'medium'
-                          slant:'r'
-                        spacing:nil
-                      pixelSize:nil
-                           size:13
-                       registry:'iso8859'
-                       encoding:'*'
+			 family:'courier'
+			 weight:'medium'
+			  slant:'r'
+			spacing:nil
+		      pixelSize:nil
+			   size:13
+		       registry:'iso8859'
+		       encoding:'*'
     "
 
     "new NT Version: 20.2.1997 / 22:33:29 / dq"
@@ -10406,14 +10418,15 @@
 	listOfFonts add:fntDescr.
 
 	"/ manually generate italic version (any font can be)
-
-	fntDescr := FontDescription
-			family:family
-			face:face
-			style:(style , '-italic')
-			size:size
-			encoding:encoding.
-	listOfFonts add:fntDescr.
+	(style startsWith:'roman') ifTrue:[
+	    fntDescr := FontDescription
+			    family:family
+			    face:face
+			    style:('italic' , (style copyFrom:'roman' size+1))
+			    size:size
+			    encoding:encoding.
+	    listOfFonts add:fntDescr.
+	].
     ].
 
     ^ listOfFonts
@@ -13705,6 +13718,6 @@
 !WinWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.167 1999-09-26 13:39:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.168 1999-09-26 13:58:26 cg Exp $'
 ! !
 WinWorkstation initialize!