Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/ATS/ATS FontInfo Sample
Function:
Required plugins for this example: MBS MacCF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/ATS/ATS FontInfo Sample
This example is the version from Sun, 17th Mar 2012.
Project "ATS FontInfo Sample.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
Control Listbox2 Inherits Listbox
ControlInstance Listbox2 Inherits Listbox
End Control
EventHandler Sub Open() if not TargetMachO then MsgBox "This example works only well on Mac OS X." end if dim a as new ATSFontListMBS dim c as integer=a.Count const kFontCopyrightName = 0 const kFontFullName = 4 const kFontTrademarkName = 7 const kFontNoPlatform =-1 const kFontNoScript=-1 const kFontNoLanguag=-1 // we test on this Japanese font dim fonid as integer=ATSUFindFontFromNameMBS("Hiragino Mincho ProN W3",kFontFullName,kFontNoPlatform, kFontNoScript, kFontNoLanguag) for i as integer=0 to c-1 if a.FontID(i) = fonid then dim cc as integer=a.FontNameCount(i) for k as integer=0 to cc dim f1 as ATSFontNameMBS=a.FontName(i,k) if f1<>nil and f1.name<>"" then dim lang, plat as string Select case f1.LanguageCode case 0 lang=" English" case 11 lang=" Japanese" else lang="" end Select Select case f1.PlatformCode case 0 plat=" Unicode" case 1 plat=" Mac" case 3 plat=" Win" else plat="" end Select Select case f1.NameCode case kFontCopyrightName listbox1.addrow f1.Name Listbox1.Cell(listbox1.LastIndex,1)=str(f1.LanguageCode)+lang Listbox1.Cell(listbox1.LastIndex,2)=str(f1.PlatformCode)+plat Listbox1.Cell(listbox1.LastIndex,3)=str(f1.ScriptCode) case kFontTrademarkName listbox2.addrow f1.Name Listbox2.Cell(listbox2.LastIndex,1)=str(f1.LanguageCode)+lang Listbox2.Cell(listbox2.LastIndex,2)=str(f1.PlatformCode)+plat Listbox2.Cell(listbox2.LastIndex,3)=str(f1.ScriptCode) End Select end if next end if next End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacCF Plugin.





Links
MBS Xojo Plugins