[futurebasic] Re: [FB] OutlineFontMetrics?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2004 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Tue, 15 Jun 2004 03:57:26 -0400
On Tuesday, June 15, 2004, at 01:57  AM, Robert Covington wrote:

> I'm sorry, that should be OutlineMetrics, not OutlineFontMetrics.
>
> Just re-reading back IM-Text ref on that. (sorry for any confusion)

I think this does the trick ok...but not sure just yet. (not setting 
window font, etc, just using console.)


'~'A
'                       Runtime : RNTM Lite.INCL
'                           CPU : Carbon
'                      Debugger : Off
'               DIM'd Vars Only : On
'              No Re-DIM'd Vars : On
'                    CALL Req'd : Off
'                 Register Vars : On
'                MacsBug Labels : On
'           Ary Bounds Checking : Off
'                     QB Labels : Off
'                 Optimize STR# : Off
'         Make Line Start Table : Off
'                 Show Warnings : Off
'~'B

begin globals // Locals were frying on me
Dim @aw(255)   as long
Dim @lsb(255)  as long
Dim @bnds(255) as Rect
end globals

Local Fn Fontificator(w$)
Dim @ndPt as long
Dim @dmPt as long
Dim @yMax%,yMin%,err

err = Fn outLineMetrics( w$[0] , @w$[0] , ndPt , dmPt , @yMax, @yMin , 
@aw(1), @lsb(1), @bnds(1))

end fn = err

dim w$
w$ = "Test Phrase"
print Fn Fontificator(w$)
dim i
for i = 1 to w$[0]
print fn Fix2long(lsb(i))
next

> r
> c
> On Tuesday, June 15, 2004, at 12:34  AM, Robert Covington wrote:
>
>> Anybody have an example of  OutlineFontMetrics in action?
>>
>> I need to get the left-side bearing for some characters in a string.
>>
>> I think that returns all that in an array for the string in question.
>>
>> Charwidth returns the 'advance width' for a character. Left-side 
>> bearing is how far over to the right  the glyph is from the pure left 
>> of the it's Advance width rect
>>
>> Like
>>
>> '   M   '
>>
>> the left side bearing in this case is 3 (units of spaces...)
>>
>> ' M     '  would be 1 in this case for the same charwidth returned.
>>
>> otherwise I just need to know it in pixels or whatever the units 
>> are...I have to draw a character into a GWorld in the proper location 
>> and have them all line up when rendered, same as if I had just used 
>> DrawString or something.
>>
>> This would also be super handy for mucking up kerning on demand in 
>> the time sink's text tool. :)
>>
>> (no clue how one gets such left-side bearing for a bitmapped font 
>> though)
>>
>> Robert
>>
>> --
>>
>
> --
>