The reverse engineered stroke table is from my cloned PCB layout code.
I wrote this short converter code. It makes the initialisation array.
A little bit of editing followed to make it Static and reduce the redundant +- couples.
Code: Select all
'=======================================================================
Dim As Integer ch, i, w, n
Dim As Integer x0, y0, x1, y1, x2, y2
Dim As String txt, s( 32 To 127 )
'-----------------------------------------------------------------------
Open "draws.bas" For Output As #1
#define v(x) trim(str( x ))
Do
Read ch, w, n
x0 = 0 ' relative start position
y0 = 0
txt = "s(" + Str( ch ) + ") = """ ' initialise string array
' note: in FB, pixel y increases downwards, so reverse y order to negate
For i = 1 To n ' number of strokes
Read x1, y1, x2, y2
If ( x0 <> x1 ) Or ( y0 <> y1 ) Then ' first move to first stroke
txt += " BM+" + v( x1 - x0 ) + "," + v( y0 - y1 )
End If
' draw stroke
txt += " M+" + v( x2 - x1 ) + "," + v( y1 - y2 )
x0 = x2 ' update pen position to end of stroke
y0 = y2
Next i
' advance to start of next character
txt += " BM+" + v( w - x0 ) + "," + v( y0 ) + """"
Print txt
Print #1, txt
Loop Until ch = 127
#undef v
Close #1
'=======================================================================
' original stroke table
' Each character is in a 6 unit high box with possible decenders -1 or -2.
' The majority of characters are four units wide, some less, V and W more.
' Only three characters ,; and < have a left protrusion to -1.
' The width of each character includes a following separator of two units,
' but does not include the left protrusion that may exist.
'--------------------------------------------------------------------
' Ascii, Width, nStrokes, strokes(x1,y1,x2,y2),(....),(....)
Data 32,6, 0 ' spc
Data 33,2, 2, 0,0,0,1, 0,2,0,6 ' !
Data 34,3, 2, 0,4,0,6, 1,4,1,6 ' "
Data 35,6, 4, 1,0,1,6, 3,0,3,6, 0,2,4,2, 0,4,4,4 ' #
Data 36,6, 8, 0,1,3,1, 3,1,4,2, 4,2,3,3, 3,3,1,3, 1,3,0,4, 0,4,1,5, 1,5,4,5, 2,0,2,6 ' $
Data 37,6,11, 0,0,0,1, 0,1,4,5, 4,5,4,6, 0,6,1,6, 1,6,1,5, 1,5,0,5, 0,5,0,6, 3,0,3,1, 3,1,4,1, 4,1,4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