
GetGlyphOutline and GGO_GLYPH_INDEX
There is another way to get the TTF outline converted to lines
Also if GetGliphOutline seems to be the right API it doesn't works in VB
There's a quick way to gliph texts using BeginPath/EndPath APIs:
Sub GlyphText(Text As String, Sz As Single, Ar() As Coord, nAr As Integer)
Dim lpPoint() As POINTAPI
Dim lpTypes() As Byte
Dim Size As Long, Ret As Long, i As Integer
Dim Pic1 As Picture
Dim x1#, y1#
Dim x!, y!
' ByPic.Show
ByPic.Pic.FontSize = Sz
ByPic.Pic.FontName = "Times New Roman"
ByPic.Pic.Cls
' Pic2.Cls
BeginPath ByPic.Pic.hdc
ByPic.Pic.CurrentX = 10
ByPic.Pic.Print Text
EndPath ByPic.Pic.hdc
Ret = FlattenPath(ByPic.Pic.hdc)
ReDim lpPoint(0)
ReDim lpTypes(0)
Size = GetPath(ByPic.Pic.hdc, lpPoint(0), lpTypes(0), 0&)
If Size > 0 Then
ReDim lpPoint(Size)
ReDim lpTypes(Size)
Ret = GetPath(ByPic.Pic.hdc, lpPoint(0), lpTypes(0), Size)
r = 0
For i = 0 To Size - 1
k = 0
Select Case lpTypes(i)
Case PT_MOVETO
x = lpPoint(i).x
y = lpPoint(i).y
x1 = x: y1 = y
If i > 0 Then k = 1
GoSub AddP
' Pic2.CurrentX = x
' Pic2.CurrentY = y
Case PTCLOSE1, PTCLOSE2
x1 = lpPoint(i).x: y1 = lpPoint(i).y
GoSub AddP
x1 = x: y1 = y
GoSub AddP
' Pic2.Line -(lpPoint(i).x, lpPoint(i).y)
' Pic2.Line -(x, y)
Case Else ' PT_LINETO, PT_BEZIERTO
x1 = lpPoint(i).x: y1 = lpPoint(i).y
GoSub AddP
' Pic2.Line -(lpPoint(i).x, lpPoint(i).y)
End Select
Next
End If
Exit Sub
AddP:
If k = 1 Then r = r + 1
nAr = nAr + 1
ReDim Preserve Ar(nAr)
Ar(nAr).x = x1
Ar(nAr).y = y1
If k = 1 Then
xA! = Ar(nAr - 1).x
yA! = Ar(nAr - 1).y
XB! = Ar(nAr).x
YB! = Ar(nAr).y
' D# = Distanza(xA, yA, XB, YB)
' Debug.Print "GLY: " & Format(D, "###0.00") & " * r = " & r
Ar(nAr - 1).t = r ' 1-invisibile
Ar(nAr).t = r
End If
Return
End Sub
If you'd like to have the whole project i'll send to you
--
Regards
Fabio Guerrazzi
VB Graphic Developer
http://www.sourcecode4free.com/cgt
ICQ: 64649187