Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/Fonts/Fonts
Function:
Required plugins for this example: MBS DynaPDF Plugin, MBS MacCF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/Fonts/Fonts
This example is the version from Tue, 23th Feb 2015.
Project "Fonts.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
EventHandler Sub Open() dim i,c as integer c=FontCount-1 for i=0 to c me.AddRow font(i) next End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control ListBox2 Inherits ListBox
ControlInstance ListBox2 Inherits ListBox
EventHandler Sub Open() dim s as CFStringMBS dim i as new ATSFontIteratorMBS dim f as ATSFontMBS =i.NextFont while f<>nil s=f.Name me.AddRow s.str s=f.PostscriptName if s<>nil then me.cell(me.LastIndex,1)=s.str end if f=i.NextFont wend End EventHandler
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control ListBox3 Inherits ListBox
ControlInstance ListBox3 Inherits ListBox
EventHandler Sub Open() dim i as ATSFontFamilyIteratorMBS dim f as ATSFontFamilyMBS dim s as CFStringMBS dim t as string i=new ATSFontFamilyIteratorMBS f=i.NextFontFamily while f<>nil s=f.Name me.AddRow s.str // Why doesn't RB show this UTF8 string correctly for japanese fonts? t=f.QuickDrawName me.cell(me.LastIndex,1)=t f=i.NextFontFamily wend End EventHandler
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control ListBox4 Inherits ListBox
ControlInstance ListBox4 Inherits ListBox
EventHandler Sub DoubleClick() MsgBox me.Cell(me.ListIndex,0) End EventHandler
EventHandler Sub Open() dim a as ATSFontListMBS dim i,c as integer dim fi,fc as integer dim f as ATSFontNameMBS const kFontCopyrightName = 0 const kFontFamilyName = 1 const kFontStyleName = 2 const kFontUniqueName = 3 const kFontFullName = 4 const kFontVersionName = 5 const kFontPostscriptName = 6 const kFontTrademarkName = 7 const kFontManufacturerName = 8 const kFontDesignerName = 9 const kFontDescriptionName = 10 const kFontVendorURLName = 11 const kFontDesignerURLName = 12 const kFontLicenseDescriptionName = 13 const kFontLicenseInfoURLName = 14 const kFontUnicodePlatform = 0 const kFontMacintoshPlatform = 1 const kFontReservedPlatform = 2 const kFontMicrosoftPlatform = 3 const kFontCustomPlatform = 4 a=new ATSFontListMBS c=a.Count for i=0 to c-1 fc=a.FontNameCount(i)-1 me.AddRow "" for fi=0 to fc f=a.FontName(i,fi) if f<>Nil then Select case f.NameCode case kFontFamilyName me.Cell(me.LastIndex,1)=ConvertEncoding(f.Name,encodings.UTF8) case kFontFullName me.Cell(me.LastIndex,0)=ConvertEncoding(f.Name,encodings.UTF8) case kFontPostscriptName me.Cell(me.LastIndex,2)=ConvertEncoding(f.Name,encodings.UTF8) case kFontUniqueName me.Cell(me.LastIndex,3)=ConvertEncoding(f.Name,encodings.UTF8) end Select end if next next End EventHandler
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control ListBox6 Inherits ListBox
ControlInstance ListBox6 Inherits ListBox
EventHandler Sub Open() dim d as new MyDynaPDF d.l=me call d.EnumHostFonts End EventHandler
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
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
Class MyDynaPDF Inherits DynapdfMBS
EventHandler Function EnumHostFont(FamilyName as string, PostScriptName as string, Style as integer) As integer l.AddRow FamilyName l.Cell(l.LastIndex,1)=PostScriptName End EventHandler
Property l As listbox
End Class
End Project

Feedback, Comments & Corrections

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




Links
MBS Xojo Chart Plugins