User Tools

Site Tools


fontsexamples

Using Fonts

This prints a list of all the loaded fonts. (A slightly modified version is integrated as PDF.Document demo04a_loadedFonts)

page := PDF.Page newInBounds: (0 @ 0 corner: 400 @ 600) colorspace: DeviceRGB new  render: [:renderer |
  renderer textRenderingMode: 0.
  renderer textObjectDo: [
    renderer setFont: #Helvetica size: 18.
    renderer textMatrix: #(1 0 0 1 10 580); showString: 'Font list'.
    Graphics.Fonts.Font loadedFonts keys asSortedCollection do: [:fontSymbol |
      renderer add: (TextPositioningOperator Td operands: #(0 -20)).
      renderer setFont: #Helvetica size: 12.
      renderer showString: fontSymbol asString.
      renderer setFont: fontSymbol size: 12.
      renderer add: (TextPositioningOperator Td operands: #(0 -15)).
      renderer showString: 'The quick brown fox jumps...']]].
page saveAndShowAs: 'loadedFonts.pdf'

demo04a_loadedfonts.pdf

fontsexamples.txt · Last modified: 2016/09/24 08:28 by dokuadmin