Platforms to show: All Mac Windows Linux Cross-Platform
/MacCG/CoreGraphics PDF/PDF Font list
Required plugins for this example: MBS MacCG Plugin, MBS MacCF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/CoreGraphics PDF/PDF Font list
This example is the version from Sun, 23th Sep 2017.
Project "PDF Font list.xojo_binary_project"
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
count=FontCount
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=font(i)
y=size-(i*20+10)
c.SetRGBFillColor 0,0,0, 1
c.SelectFont s, 12, 1
// ShowTextAtPoint does not do all encodings correct
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:
- /MacCG/CoreGraphics DirectDisplay/Capture Screen with CGContextMBS
- /MacCG/CoreGraphics DirectDisplay/CGDisplayMBS CreateImageAsync
- /MacCG/CoreGraphics DirectDisplay/CGDisplayStreamEvent test
- /MacCG/CoreGraphics DirectDisplay/CGScreenRefreshEvent Test
- /MacCG/CoreGraphics PDF/Create PDF with Picture
- /MacCG/CoreGraphics PDF/Getpicture PDF
- /MacCG/CoreGraphics PDF/PDF properties
- /MacCG/CoreGraphics PDF/PDF Transparency
- /MacCG/CoreGraphics PDF/Show PDF
- /MacCG/CoreGraphics PDF/Simple Make PDF
The items on this page are in the following plugins: MBS MacCG Plugin.