GetGlyphOutline and GGO_GLYPH_INDEX 
Author Message
 GetGlyphOutline and GGO_GLYPH_INDEX

<I tried this one already in mpvb.winapi, but may be it should better
placed here although it's is not or not only a question of graphics>

Hi, Folks!

(Platform: WIN95/ VB 5.0)

Did anybody out there ever succeed in using the API function
GetGlyphOutline() in combination with GGO_GLYPH_INDEX?
I tried nearly every imaginable combination of the parameters to get to a
result, but it didn't work. The glyph indices are correct, I got them from
the 'cmap' table of the TTF file itself.
I also tried it with the GetGlyphOutlineW() function in unicows.dll of the
MS Unicode Layer - but that doesn't work as well (BTW: strangely, this
function on my computer returns a glyph outline for a unicode character if
used with GGO_NATIVE - but not the right one! Instead it returns the
question mark glyph for character codes > FFh...).
Any suggestion in this thread or by e-mail are welcome!

----------------------------------------------------------------------
THORSTEN ALBERS                                 Universit?t Freiburg

                                                       uni-freiburg.de
----------------------------------------------------------------------



Thu, 29 Apr 2004 01:10:50 GMT  
 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



Thu, 29 Apr 2004 21:12:22 GMT  
 GetGlyphOutline and GGO_GLYPH_INDEX


Quote:
> 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:

Thank You very much for this suggestion. Unfortunately I can not use it,
since I wan't to read the unmodified glyph's.
It is realy difficult to understand why MS gives the information that
GGO_GLYPH_INDEX is for WINDOWS 95 - and then it doesn't work under WINDOWS
95.

----------------------------------------------------------------------
THORSTEN ALBERS                                 Universit?t Freiburg

                                                       uni-freiburg.de
----------------------------------------------------------------------



Fri, 30 Apr 2004 02:13:36 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help needed with GetGlyphOutline

2. Vertically Centering Characters w/ GetGlyphOutline

3. GetGlyphOutline not working in VB 5.0

4. GetGlyphOutline

5. need help to use getglyphoutline api to work in VB6

6. How to use WinAPI:GetGlyphOutline ?

7. using getGlyphOutline in VB6 ?

8. GetGlyphOutline and UNICODE

9. Help needed with GetGlyphOutline

10. Help needed with GetGlyphOutline

11. How to use WinAPI:GetGlyphOutline ?

 

 
Powered by phpBB® Forum Software