Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/CoreGraphics PDF/PDF Fontfamily list
Function:
Required plugins for this example: MBS MacCF Plugin, MBS MacCG Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/CoreGraphics PDF/PDF Fontfamily list
This example is the version from Sun, 23th Sep 2017.
Project "PDF Fontfamily list.rbp"
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() // Original example can be found on Apple's Website. // Translation from C is quite easy ;-) dim c as CGContextMBS dim f as FolderItem dim r as CGRectMBS dim size, y, i, count as integer dim s as String dim ff as FontFamilyIteratorMBS dim fo as FontFamilyMBS dim fos(-1) as FontFamilyMBS ff=new FontFamilyIteratorMBS fo=ff.NextFontFamily while fo<>Nil fos.Append fo fo=ff.NextFontFamily wend count=UBound(fos)+1 size=count*20+20 f=SpecialFolder.Desktop.Child("RB Fontlist Demo.pdf") r=CGMakeRectMBS(0,0,400,size) // Create the context c=CGNewPDFDocumentMBS(f,r,"PDF from Xojo","Christian Schmitz","MBS Plugin 2.7") if c<>nil then // We must begin a new page before drawing to a PDF context c.BeginPage(r) count=count-1 // 0 based array for i=0 to count s=fos(i).name y=size-(i*20+10) c.SetRGBFillColor 0,0,0, 1 c.SelectFont s, 12, 1 c.ShowTextAtPoint s,10,y c.SelectFont "Times New Roman", 12, 1 c.ShowTextAtPoint s,230,y c.ShowTextAtPoint str(i+1),210,y next // We've finished rendering the page c.EndPage c.Flush c=nil // to force the file to be written as we want to launch it f.Launch else MsgBox "Failed to creator file!" end if quit End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

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





Links
MBS Xojo Plugins