Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
fontsimport [2016/09/24 15:46] christian |
fontsimport [2023/01/05 20:29] (current) christian |
||
---|---|---|---|
Line 8: | Line 8: | ||
<code smalltalk> | <code smalltalk> | ||
- | Graphics.Fonts.Font loadedFonts. | + | Graphics.Fonts.Font loadedFonts. |
- | Graphics.Fonts.Font fontAt: # | + | Graphics.Fonts.Font fontAt: # |
Graphics.Fonts.Font fontAt: #' | Graphics.Fonts.Font fontAt: #' | ||
+ | Graphics.Fonts.Font resetLoadedFonts. | ||
</ | </ | ||
+ | |||
+ | The method # | ||
+ | |||
+ | Package [Fonts Development] adds some import helpers for OpenTalk and Type-1 (CustomFont) Fonts: | ||
+ | |||
+ | <code smalltalk> | ||
+ | Graphics.Fonts.OpenTalk.Font importFile: aFilename in: aPackagenameSymbol. | ||
+ | Graphics.Fonts.OpenTalk.Font importAllIn: | ||
+ | Graphics.Fonts.OpenTalk.Font importInstalledWindowsFont: | ||
+ | " | ||
+ | Graphics.Fonts.CustomFont import: filenameTrunk as: selectorSymbol. | ||
+ | </ | ||
+ | |||
+ | For example when you add the ' | ||
+ | |||
+ | <code smalltalk> | ||
+ | Graphics.Fonts.OpenType.Font importFile: ' | ||
+ | </ | ||
+ | |||
+ | This creates a class method for Graphics.Fonts.OpenType.Font: | ||
+ | |||
+ | <code smalltalk> | ||
+ | mICRDemoCheckPrixa | ||
+ | <font: # | ||
+ | ^self file: ' | ||
+ | ': | ||
+ | </ | ||
+ | |||
+ | The newly imported Font can be accessed by | ||
+ | |||
+ | <code smalltalk> | ||
+ | Graphics.Fonts.Font fontAt: # | ||
+ | </ | ||
+ | |||
+ | and used in PDF for text as usual by its name: | ||
<code smalltalk> | <code smalltalk> | ||
- | Graphics.Fonts.OpenType.Font importFile: 'MICRDemoCheckPrixa.otf' | + | | page | |
+ | page := Page newInBounds: | ||
+ | renderer textObjectDo: | ||
+ | renderer setFont: # | ||
+ | renderer add: (NextLineRelative operands: #(10 10)). | ||
+ | renderer showString: '01234567890 / ; : -']]. | ||
+ | page saveAndShowAs: 'demo04b_MICRDemo.pdf' | ||
</ | </ |