Platforms to show: All Mac Windows Linux Cross-Platform

/DynaPDF/Font Infos


Required plugins for this example: MBS DynaPDF Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /DynaPDF/Font Infos

This example is the version from Fri, 4th Sep 2014.

Project "Font Infos.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub Change() Update End EventHandler
End Control
Control Liste Inherits Listbox
ControlInstance Liste Inherits Listbox
End Control
EventHandler Sub Open() dim d as new MyDynaPDFMBS call d.CreateNewPDF dim file as FolderItem = GetOpenFolderItem(FileTypes1.Pdf) if file = nil then quit call d.OpenImportFile(file) call d.ImportPDFFile(1) // for showing fonts in current PDF: dim c as integer = d.GetFontCount-1 for i as integer = 0 to c dim f as DynaPDFFontInfoMBS = d.GetFontInfoEx(i) dim n as string = f.FullName if n = "" then n = f.BaseFont end if List.AddRow n List.RowTag(List.LastIndex) = f next End EventHandler
Sub Update() Liste.DeleteAllRows if List.ListIndex = -1 then Return end if dim f as DynaPDFFontInfoMBS = list.RowTag(List.ListIndex) Liste.AddRow "Ascent", str(f.Ascent) Liste.AddRow "AvgWidth", str(f.AvgWidth) Liste.AddRow "BaseEncoding", strBaseEncoding(f.BaseEncoding) Liste.AddRow "BaseFont", f.BaseFont Liste.AddRow "CapHeight", str(f.CapHeight) Liste.AddRow "CharSet", f.CharSet Liste.AddRow "CharSetSize", str(f.CharSetSize) Liste.AddRow "CIDOrdering", str(f.CIDOrdering) Liste.AddRow "CIDRegistry", str(f.CIDRegistry) Liste.AddRow "CIDSet", strMemory(f.CIDSet) Liste.AddRow "CIDSetSize", str(f.CIDSetSize) Liste.AddRow "CIDSupplement", str(f.CIDSupplement) Liste.AddRow "CIDToGIDMap", strMemory(f.CIDToGIDMap) Liste.AddRow "CIDToGIDMapSize", str(f.CIDToGIDMapSize) Liste.AddRow "CMapBuf", strMemory(f.CMapBuf) Liste.AddRow "CMapBufSize", str(f.CMapBufSize) Liste.AddRow "CMapName", str(f.CMapName) Liste.AddRow "Descent", str(f.Descent) Liste.AddRow "Encoding", strMemory(f.Encoding) Liste.AddRow "FirstChar", str(f.FirstChar) Liste.AddRow "Flags", hex(f.Flags) Liste.AddRow "FontBBox", strRect(f.FontBBox) Liste.AddRow "FontBuffer", strMemory(f.FontBuffer) Liste.AddRow "FontBufSize", str(f.FontBufSize) Liste.AddRow "FontFamily", f.FontFamily Liste.AddRow "FontFilePath", f.FontFilePath Liste.AddRow "FontFileType", strFontFileType(f.FontFileType) Liste.AddRow "FontName", f.FontName Liste.AddRow "FontStretch", f.FontStretch Liste.AddRow "FontType", strFontType(f.FontType) Liste.AddRow "FontWeight", str(f.FontWeight) Liste.AddRow "FullName", f.FullName Liste.AddRow "HaveEncoding", strBool(f.HaveEncoding) 'Liste.AddRow "HorzWidths", str(f.HorzWidths) Liste.AddRow "HorzWidthsCount", str(f.HorzWidthsCount) Liste.AddRow "Imported", strBool(f.Imported) Liste.AddRow "ItalicAngle", str(f.ItalicAngle) Liste.AddRow "Lang", str(f.Lang) Liste.AddRow "LastChar", str(f.LastChar) Liste.AddRow "Leading", str(f.Leading) Liste.AddRow "Length1", str(f.Length1) Liste.AddRow "Length2", str(f.Length2) Liste.AddRow "Length3", str(f.Length3) Liste.AddRow "MaxWidth", str(f.MaxWidth) Liste.AddRow "Metadata", strMemory(f.Metadata) Liste.AddRow "MetadataSize", str(f.MetadataSize) Liste.AddRow "MisWidth", str(f.MisWidth) Liste.AddRow "Panose", strMemory(f.Panose) Liste.AddRow "PostScriptName", f.PostScriptName Liste.AddRow "SpaceWidth", str(f.SpaceWidth) Liste.AddRow "StemH", str(f.StemH) Liste.AddRow "StemV", str(f.StemV) Liste.AddRow "ToUnicode", strMemory(f.ToUnicode) Liste.AddRow "ToUnicodeSize", str(f.ToUnicodeSize) Liste.AddRow "VertDefPos", strPoint(f.VertDefPos) Liste.AddRow "VertWidthsCount", str(f.VertWidthsCount) Liste.AddRow "WMode", str(f.WMode) Liste.AddRow "XHeight", str(f.XHeight) End Sub
Function strBaseEncoding(n as integer) As string Select case n case DynaPDFMBS.kbeMacExpert Return "MacExpert" case DynaPDFMBS.kbeMacRoman Return "MacRoman" case DynaPDFMBS.kbeStandard Return "Standard" case DynaPDFMBS.kbeWinAnsi Return "WinAnsi" else Return "unknown: "+str(n) end Select End Function
Function strBool(b as Boolean) As string if b then Return "yes" else Return "no" end if End Function
Function strFontFileType(n as integer) As string Select case n case DynaPDFMBS.kffsCIDFontType0C Return "CIDFontType0C" case DynaPDFMBS.kffsCIDFontType2 Return "CIDFontType2" case DynaPDFMBS.kffsNoSubtype Return "NoSubtype" case DynaPDFMBS.kffsOpenType Return "OpenType" case DynaPDFMBS.kffsOpenTypeC Return "OpenTypeC" case DynaPDFMBS.kffsType1C Return "Type1C" else Return "unknown: "+str(n) end Select End Function
Function strFontType(n as integer) As string Select case n case DynaPDFMBS.kftMMType1 // 0 Return "MMType1" case DynaPDFMBS.kftTrueType // 1 Return "TrueType" case DynaPDFMBS.kftType0 // 2 Return "Type0" case DynaPDFMBS.kftType1 // 3 Return "Type1" case DynaPDFMBS.kftType3 // 4 Return "Type3" else Return "unknown: "+str(n) end Select End Function
Function strMemory(m as MemoryBlock) As string if m = nil then Return "n/a" end if dim s as string = leftb(m, 100) dim e as string = EncodeHex(s)+"..." Return e End Function
Function strPoint(r as DynapdfPointMBS) As string if r = nil then Return "n/a" end if Return str(r.x)+"/"+str(r.y) End Function
Function strRect(r as DynaPDFRectMBS) As string if r = nil then Return "n/a" end if Return str(r.Left)+"/"+str(r.top)+" "+str(r.Right)+"/"+str(r.Bottom) End Function
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyDynaPDFMBS Inherits DynaPDFMBS
EventHandler Function Error(ErrorCode as integer, ErrorMessage as string, ErrorType as integer) As integer // output all messages on the console: System.DebugLog str(ErrorCode)+": "+ErrorMessage // and display dialog: Dim d as New MessageDialog //declare the MessageDialog object Dim b as MessageDialogButton //for handling the result d.icon=MessageDialog.GraphicCaution //display warning icon d.ActionButton.Caption="Continue" d.CancelButton.Visible=True //show the Cancel button // a warning or an error? if BitAnd(ErrorType, me.kE_WARNING) = me.kE_WARNING then // if user decided to ignore, we'll ignore if IgnoreWarnings then Return 0 d.Message="A warning occurred while processing your PDF code." // we add a third button to display all warnings d.AlternateActionButton.Caption = "Ignore warnings" d.AlternateActionButton.Visible = true else d.Message="An error occurred while processing your PDF code." end if d.Explanation = str(ErrorCode)+": "+ErrorMessage b=d.ShowModal //display the dialog Select Case b //determine which button was pressed. Case d.ActionButton Return 0 // ignore Case d.AlternateActionButton IgnoreWarnings = true Return 0 // ignore Case d.CancelButton Return -1 // stop End select End EventHandler
Property IgnoreWarnings As Boolean
End Class
FileTypes1
Filetype application/pdf
End FileTypes1
End Project

See also:

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


The biggest plugin in space...