Okay, I found one I like...
What's interesting is the "monospace" handle is essentially useless if you try to use it with non-monospaced font. Too many display problems, and forget about using the PRINT statement in graphics mode if you do try and go that way. It will throw the character positioning waaaaaay off. _PrintString works, but, again, the fonts will probably display poorly. My advice, stick with monospaced fonts or make a routine with _PrintWidth to improve the presentation of non-monospaced fonts if you are trying to preserve a fixed number of character spaces per line.
Pete
Code: (Select All)
Screen _NewImage(860, 300, 32)
_Delay .1
_ScreenMove _Middle
_Delay .1
nof = 4
ReDim fh(nof) As Long
fh(0) = _LoadFont("c:\windows\fonts\lucon.ttf", 16)
fh(1) = _LoadFont("RobotoMono-regular.ttf", 21, "monospace")
fh(2) = _LoadFont("RobotoMono-regular.ttf", 21)
For i = 0 To 2
If fh(i) <= 0 Then
Print "Failed to load font."
End
End If
Next
_PrintString (16, 21), " Test for a monospaced font. a and b will align if mono..."
_Font fh(1)
_PrintString (16, 21 * 3), "mmmmmmmmmmmmmmmmmmmma"
_Font fh(2)
Locate 4, 16
_PrintString (16, 21 * 4), "mmmmmmmmmmmmmmmmmmmmb"
_Font fh(0)
fh(0) = _LoadFont("c:\windows\fonts\lucon.ttf", 16)
fh(1) = _LoadFont("RobotoMono-regular.ttf", 21)
fh(2) = _LoadFont("RobotoMono-bold.ttf", 21)
fh(3) = _LoadFont("RobotoMono-italic.ttf", 21)
fh(4) = _LoadFont("RobotoMono-bolditalic.ttf", 21)
For i = 0 To nof
If fh(i) <= 0 Then
Print "Failed to load font."
End
End If
Next
Locate 9, 16: Print " Here's how they look...";
If print0 Then
x = 16: y = 8: a = 0: k = 0
For i = 1 To 26 * 4
a = a + 1
_Font fh(a)
Locate y, x: Print Chr$(97 + k);
x = x + 16
If i = 26 * 2 Then y = y + 1: x = 16
If i Mod 4 = 0 Then a = 0: k = k + 1
Next
Else
x = 15: y = 21 * 8
For i = 1 To 26 * 4
a = a + 1
_Font fh(a)
_PrintString (x, y), Chr$(97 + k)
x = x + 16
If i = 26 * 2 Then y = y + 21: x = 15
If i Mod 4 = 0 Then a = 0: k = k + 1
Next
End If
_Font fh(0)
End
What's interesting is the "monospace" handle is essentially useless if you try to use it with non-monospaced font. Too many display problems, and forget about using the PRINT statement in graphics mode if you do try and go that way. It will throw the character positioning waaaaaay off. _PrintString works, but, again, the fonts will probably display poorly. My advice, stick with monospaced fonts or make a routine with _PrintWidth to improve the presentation of non-monospaced fonts if you are trying to preserve a fixed number of character spaces per line.
Pete