exampleLines
   "Show the functionality from the PDFPrinter: This method shows
    the print styles for lines"
   "PDFPrinter exampleLines"

   | printer boldStyle style |
   printer := Printer startPrintJobNamed: 'LineExample.pdf'.
   printer printBlock: [
      | gc device left top styles dash colors font title |
      device := printer graphicsDevice.
      gc := printer graphicsContext.

      "Define the font and style for the sub titles"
      (font := FontDescription new pixelSize: 14)
            family: 'helvetica';
            boldness: 1.0;
            italic: false.
      boldStyle := TextAttributes defaultFontQuery: font copy.

      "Define the font and style for the descriptions"
      (font := FontDescription new pixelSize: 12)
            family: 'helvetica';
            boldness: 0.5;
            italic: false.
      style := TextAttributes defaultFontQuery: font copy.

      "Print the title line"
      gc paint: ColorValue black.
      (font := FontDescription new pixelSize: 18)
            family: 'helvetica';
            boldness: 1.0;
            italic: false.
      title := 'PDFPrinter functionality (Line Styles)'.
      (ComposedText
         withText: title
         style: (TextAttributes defaultFontQuery: font copy))
            newGraphicsDevice: device;
            displayOn: gc at: 120 @ 20.

      (ComposedText withText: 'Lines styles' style: boldStyle)
         newGraphicsDevice: device;
         displayOn: gc at: 20@50.

      "Display a line with different line width"
      top := 80.
      left := 20.
      gc capStyle: 2; joinStyle: 1.
      #(0 1 3 5 8 13) do: [:width |
         (ComposedText
            withText: ('Text Width: ' , width printString)
            style: style)
               newGraphicsDevice: device;
               displayOn: gc at: left@top.
         top := top + 25.
         gc lineWidth: width.
         gc paint: ColorValue blue.
         gc displayLineFrom: left@top to: (left + 100)@top.
         gc paint: ColorValue black.
         top := top + 10].

      "Display a line with different line end styles"
      top := 80.
      left := 180.
      gc lineWidth: 8; joinStyle: 1.
      styles := #('Butt' 'Round' 'Projecting').
      1 to: 3 do: [:cap |
         (ComposedText
            withText: ('Cap Style: ' , (styles at: cap))
            style: style)
               newGraphicsDevice: device;
               displayOn: gc at: left@top.
         top := top + 25.
         gc capStyle: cap.
         gc paint: ColorValue blue.
         gc displayLineFrom: left@top to: (left + 100)@top.
         gc paint: ColorValue black.
         top := top + 10].

      "Display a line with different dash patterns"
      top := 80.
      left := 340.
      styles := #('1' '3 7' '8 7 2 7').
      dash := (Array
                 with: self dashPattern1
                 with: self dashPattern37
                 with: self dashPattern8727).
      gc lineWidth: 1; joinStyle: 1; capStyle: 1.
      1 to: 3 do: [:index |
         title := 'Dash Pattern: ' , (styles at: index).
         (ComposedText withText: title style: style)
            newGraphicsDevice: device;
            displayOn: gc at: left@top.
         top := top + 25.
         gc paint: (dash at: index).
         gc displayLineFrom: left@top to: (left + 100)@top.
         gc paint: ColorValue black.
         top := top + 10].

      "Display a line with different dash patterns and in color"
      dash := (Array
               with: (self coloredDashPattern8727: 'Red')
               with: (self coloredDashPattern8727: 'Green')
               with: (self coloredDashPattern8727: 'Blue')).
      colors := #('Red' 'Green' 'Blue').
      1 to: 3 do: [:index |
         title := 'Dash Pattern: ' , (styles at: index) ,
                  ' with color: ' , (colors at: index).
         (ComposedText withText: title style: style)
            newGraphicsDevice: device;
            displayOn: gc at: left@top.
         top := top + 25.
         gc paint: (dash at: index).
         gc displayLineFrom: left@top to: (left + 100)@top.
         gc paint: ColorValue black.
         top := top + 10].

      "Display two lines in an angle and show how they are joined"
      (ComposedText withText: 'Joining Lines' style: boldStyle)
         newGraphicsDevice: device;
         displayOn: gc at: 20@320.

      top := 350.
      left := 20.
      gc lineWidth: 13; capStyle: 1.
      styles := #('Mitter Joint' 'Round Join' 'Bevel Join').
      1 to: 3 do: [:join |
         | points |
         (ComposedText
            withText: ('Join Style: ' , (styles at: join))
            style: style)
               newGraphicsDevice: device;
               displayOn: gc at: left@top.
         points := Array
                  with: (left + 20)@(top + 75)
                  with: (left + 60)@(top + 35)
                  with: (left + 100)@(top + 75).
         gc paint: ColorValue blue.
         gc joinStyle: join.
         gc displayPolyline: points at: 0@0.
         gc paint: ColorValue black.
         left := left + 160]]