I suppose I should throw in an example. Incomplete, but works as a demo...
You only need the regular, bold, italics, and italics bold from the first zip for the routine, as currently coded.
Pete
Code: (Select All)
Screen _NewImage(900, 600, 32)
nof = 4
ReDim fh(nof), mystring$(nof)
fh(1) = _LoadFont("lmsans10-regular.otf", 21)
fh(2) = _LoadFont("lmsans10-bold.otf", 21)
fh(3) = _LoadFont("lmsans10-oblique.otf", 21)
fh(4) = _LoadFont("lmsans10-boldoblique.otf", 21)
For i = 1 To nof
If fh(i) <= 0 Then
Print "Failed to load font."
End
End If
Next
_Font fh(1)
For i = 1 To nof
Restore text_data
mystring$(i) = LoadUData$
Next
x = 8: j = 1
f = 1: _UPrintString (8, _Height \ 2 - _UFontHeight \ 2 + y - 48), mystring$(f), _Width, 8
For i = 1 To nof * 26 ' Step 4
f = (i - 1) Mod 4 + 1
'f = 1: q = q + 1
If f = 2 Or f = 4 Then adj = 1 Else adj = 0
_Font fh(f)
'_UPrintString (x, _Height \ 2 - _UFontHeight \ 2 + y + adj), Mid$(mystring$(f), q, 1), _Width, 8
_UPrintString (x, _Height \ 2 - _UFontHeight \ 2 + y + adj), Mid$(mystring$(f), j, 1), _Width, 8
If i = nof / 2 * 26 Then
x = 8
y = y + 48
Else
If mono Then
x = x + 11 ' For mono-spaced fonts.
Else
x = x + _PrintWidth(Mid$(mystring$(f), j, 1))
End If
End If
If i Mod 4 = 0 Then j = j + 1
Next
_Font fh(1)
End
text_data:
Data 61,62,63,64,65,66,67,68,69,6A,6B,6C,6D,6E,6F,70,71,72,73,74,75,76,77,78,79,7A,7B
Data E2,96,8F
Data E2,89,A1
Function LoadUData$
Dim As _Unsigned Long i, s
Dim d As String
Dim buffer As String
s = 26
buffer = Space$(s)
For i = 1 To s
Read d
Asc(buffer, i) = Val("&h" + d)
Next
LoadUData = buffer
End Function
You only need the regular, bold, italics, and italics bold from the first zip for the routine, as currently coded.
Pete