Sample script

Build 1501 on 14/Nov/2017  This topic last edited on: 9/May/2012, at 13:02

Use this example to demonstrate the functions of the Font object:

Dim objFont = Ted.GetFont

objFont.Code = 10031

 

dim str as String = ""

dim c as String

dim i as integer

str = str & "Code: " & objFont.Code & chr(13) & chr(10)

str = str & "Name: " & objFont.Name & chr(13) & chr(10)

str = str & "Family: " & objFont.Family & chr(13) & chr(10)

str = str & "PFB: " & objFont.PFB & chr(13) & chr(10)

str = str & "Bold: " & objFont.IsBold & chr(13) & chr(10)

str = str & "Italic: " & objFont.IsItalic & chr(13) & chr(10)

str = str & "Description: " & objFont.Description & chr(13) & chr(10)

str = str & "EM width: " & objFont.EMWidth & chr(13) & chr(10)

str = str & "EN width: " & objFont.ENWidth & chr(13) & chr(10)

str = str & "Thin width: " & objFont.ThinWidth & chr(13) & chr(10)

str = str & "Slant: " & objFont.Slant & chr(13) & chr(10)

str = str & "Cap. height: " & objFont.CapHeight & chr(13) & chr(10)

str = str & "X height: " & objFont.XHeight & chr(13) & chr(10)

str = str & "Des. depth: " & objFont.DesDepth & chr(13) & chr(10)

str = str & "Axis height: " & objFont.AxisHeight & chr(13) & chr(10)

str = str & "Small caps. width: " & objFont.SmallCapsWidth & chr(13) & chr(10)

str = str & "Small caps. height: " & objFont.SmallCapsHeight & chr(13) & chr(10)

str = str & "Layout id: " & objFont.LayoutId & chr(13) & chr(10)

MsgBox (str)

 

str = "Kerning table:" & chr(13) & chr(10)

For i = 0 To objFont.NKernPairs-1

 str = str & objFont.KernPair(i) & " " & objFont.KernValue(i) & chr(13) & chr(10)

Next

MsgBox (str)

 

str = "Width, height and depth:" & chr(13) & chr(10)

c = "A"

str = str & c & ": " & objFont.CharWidth(asc(c)) & " " & objFont.CharHeight(asc(c)) & " " & objFont.CharDepth(asc(c)) & chr(13) & chr(10)

c = "g"

str = str & c & ": " & objFont.CharWidth(asc(c)) & " " & objFont.CharHeight(asc(c)) & " " & objFont.CharDepth(asc(c)) & chr(13) & chr(10)

c = "x"

str = str & c & ": " & objFont.CharWidth(asc(c)) & " " & objFont.CharHeight(asc(c)) & " " & objFont.CharDepth(asc(c)) & chr(13) & chr(10)

MsgBox (str)