Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/ATS/Map fonts
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/Map fonts
This example is the version from Sun, 17th Mar 2012.
Project "Map fonts.rbp"
FileTypes
Filetype text
End FileTypes
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() FindFonts dim i,c as integer c=UBound(fonts) for i=0 to c dim f as MyFont=fonts(i) MainWindow.Liste.AddRow f.RealbasicName MainWindow.Liste.Cell(MainWindow.Liste.LastIndex,1)=f.ATSFontFamilyName MainWindow.Liste.Cell(MainWindow.Liste.LastIndex,2)=f.ATSFontPostscriptName MainWindow.Liste.Cell(MainWindow.Liste.LastIndex,3)=f.ATSFontPostscriptNameBold MainWindow.Liste.Cell(MainWindow.Liste.LastIndex,4)=f.ATSFontPostscriptNameItalic next End EventHandler
Sub FindFonts() dim i,c as integer c=FontCount-1 for i=0 to c fonts.append new MyFont(font(i)) next End Sub
Property fonts() As MyFont
End Class
Class MainWindow Inherits Window
Control Liste Inherits Listbox
ControlInstance Liste Inherits Listbox
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
End Class
Class MyFont
Sub Constructor(s as string) RealbasicName=s dim f as ATSFontMBS dim ATSFontFamily as ATSFontFamilyMBS = ATSFontFamilyFindFromNameMBS(s) if ATSFontFamily<>nil then ATSFontFamilyName=ATSFontFamily.Name const normal = 0 const bold = 1 const italic = 2 const underline = 4 const outline = 8 const shadow = &h10 const condense = &h20 const extend = &h40 f=ATSFontFamily.Font(normal) if f<>nil then ATSFontName=f.Name ATSFontPostscriptName=f.PostscriptName end if f=ATSFontFamily.Font(bold) if f<>nil then ATSFontPostscriptNameBold=f.PostscriptName end if f=ATSFontFamily.Font(italic) if f<>nil then ATSFontPostscriptNameItalic=f.PostscriptName end if end if End Sub
Property ATSFontFamilyName As string
Property ATSFontName As string
Property ATSFontPostscriptName As string
Property ATSFontPostscriptNameBold As string
Property ATSFontPostscriptNameItalic As string
Property CocoaFontName As string
Property RealbasicName As string
End Class
End Project

Feedback, Comments & Corrections

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




Links
MBS Xojo tutorial videos