├── README.md ├── ch01-text-theory-files ├── Batillaria_multiformis_01_for_sale-enhance.JPG ├── Batillaria_multiformis_01_for_sale.JPG ├── CourierA.PNG ├── CourierA │ ├── BMP-13px.PNG │ ├── BMP-17px.PNG │ ├── CourierA.xcf │ ├── TTF-fitted-13px.PNG │ ├── TTF-fitted-17px.PNG │ ├── TTF-fitted-28px-anti-aliased.PNG │ └── TTF.PNG ├── File-Batillaria multiformis 01 for sale.JPG - Wikimedia Commons.url ├── Jazz & Coffee Masako #7 - Flickr - Photo Sharing!.url ├── Sign - Flickr - Photo Sharing!.url ├── char-vs-glyph.PNG ├── char-vs-glyph.hires.PNG ├── char-vs-glyph.svg ├── font-families.PNG ├── font-families.hires.PNG ├── font-families.svg ├── index.html ├── japanese-snails.JPG ├── script-vs-lang.PNG ├── script-vs-lang.hires.PNG └── script-vs-lang.svg ├── ch02-text-basics-files ├── flower-heading.PNG ├── flower-heading.svg ├── flower-labels-accessible.PNG ├── flower-labels-accessible.svg ├── flower-labels.svg ├── flower.PNG ├── flower.svg ├── font-size.PNG ├── font-size.html ├── index.html ├── text-css-longhand.svg ├── text-css.svg ├── text-filter.PNG ├── text-filter.svg ├── text-labels.PNG ├── text-labels.svg ├── text-simple.PNG ├── text-simple.svg ├── text-size.PNG ├── text-size.svg ├── text-styled.PNG ├── text-styled.svg └── text-transform.svg ├── ch03-fill-stroke-files ├── currentColor-icon-oops.PNG ├── currentColor-icon-oops.html ├── currentColor-icon.PNG ├── currentColor-icon.html ├── gradient-headings-tspan.PNG ├── gradient-headings-tspan.html ├── gradient-headings.PNG ├── gradient-headings.html ├── gradient-text.PNG ├── gradient-text.svg ├── index.html ├── stroked-headings.PNG ├── stroked-headings.html ├── tspan-formatting.PNG └── tspan-formatting.svg ├── ch04-position-tspan-files ├── index.html ├── little-crocodile.PNG ├── little-crocodile.svg ├── mouses-tale-re-position.svg ├── mouses-tale.PNG ├── mouses-tale.svg ├── tspan-position-absolute.PNG ├── tspan-position-absolute.svg ├── tspan-position-percentage-bottom.svg ├── tspan-position-percentage-compare.PNG ├── tspan-position-percentage-compare.html ├── tspan-position-percentage-offset.svg └── tspan-position-relative.svg ├── ch05-position-char-files ├── bam-boom.FF.PNG ├── bam-boom.IE.PNG ├── bam-boom.gradients.PNG ├── bam-boom.gradients.xcf ├── bam-boom.svg ├── character-position-relative.svg ├── character-position.PNG ├── character-position.svg ├── character-rotation.PNG ├── character-rotation.svg ├── character-tspan-position.PNG ├── character-tspan-position.svg └── index.html ├── ch06-text-anchor-files ├── index.html ├── text-anchor.PNG ├── text-anchor.svg ├── text-chunk-anchor-IE-test.svg ├── text-chunk-anchor-dx.svg ├── text-chunk-anchor-fix-whitespace.PNG ├── text-chunk-anchor-fix-whitespace.svg ├── text-chunk-anchor.PNG ├── text-chunk-anchor.svg └── whitespace-test.svg ├── ch07-rtl-vertical-files ├── index.html ├── text-direction-2column.html ├── text-direction.PNG ├── text-direction.html ├── vertical-modes-fallback.Chrome.PNG ├── vertical-modes-fallback.PNG ├── vertical-modes-fallback.svg ├── vertical-modes-future.svg ├── vertical-modes.PNG └── vertical-modes.svg ├── ch08-baselines-files ├── baseline-shift-fallback.PNG ├── baseline-shift-fallback.svg ├── baseline-shift.PNG ├── baseline-shift.svg ├── baselines.PNG ├── baselines.svg └── index.html ├── ch09-textPath-files ├── circle-text-absolute.PNG ├── circle-text-absolute.svg ├── circle-textPath-arabic-centered.PNG ├── circle-textPath-arabic-centered.svg ├── circle-textPath-arabic-centered.zoom.PNG ├── circle-textPath-arabic-flat.PNG ├── circle-textPath-arabic-flat.svg ├── circle-textPath-arabic-styled.svg ├── circle-textPath-arabic.svg ├── circle-textPath-centered-xy.svg ├── circle-textPath-centered.PNG ├── circle-textPath-centered.svg ├── circle-textPath-dy.PNG ├── circle-textPath-dy.svg ├── circle-textPath-hebrew-centered.svg ├── circle-textPath-hebrew-end.svg ├── circle-textPath-hebrew.PNG ├── circle-textPath-hebrew.svg ├── circle-textPath-multiline.PNG ├── circle-textPath-multiline.svg ├── circle-textPath-rotated.svg ├── circle-textPath-styled.PNG ├── circle-textPath-styled.svg ├── circle-textPath-xy.svg ├── circle-textPath.PNG ├── circle-textPath.svg ├── index.html ├── textPath-startOffset.svg └── walrus-carpenter.svg ├── ch10-fonts-files ├── bam-boom-comparison.Arial.PNG ├── bam-boom-comparison.Cooper.PNG ├── bam-boom-comparison.GillSans.PNG ├── bam-boom-comparison.Goudy.PNG ├── bam-boom-comparison.Impact.PNG ├── bam-boom-comparison.PNG ├── bam-boom-comparison.Showcard.PNG ├── bam-boom-comparison.hi-res.PNG ├── bam-boom-comparison.xcf ├── bam-boom-postscript-names.svg ├── generic-fonts-cursive.PNG ├── generic-fonts-cursive.svg ├── generic-fonts-fantasy.PNG ├── generic-fonts-fantasy.svg ├── generic-fonts-monospace.PNG ├── generic-fonts-monospace.svg ├── generic-fonts-sans-serif.PNG ├── generic-fonts-sans-serif.svg ├── generic-fonts-serif.PNG ├── generic-fonts-serif.svg ├── index.html ├── penpal-fonts.PNG └── penpal-fonts.svg ├── ch11-size-adjust-files ├── index.html ├── lengthAdjust.PNG ├── lengthAdjust.html ├── penpal-font-adjust-comparison.PNG ├── penpal-font-adjust-comparison.xcf ├── penpal-font-adjust-fallback-no-adjust.PNG ├── penpal-font-adjust-fallback.PNG ├── penpal-font-adjust-no-adjust.PNG ├── penpal-font-adjust.PNG ├── penpal-font-adjust.svg ├── penpal-fonts-fallback-comparison.PNG ├── penpal-fonts-fallback-comparison.xcf └── penpal-fonts-fallback.PNG ├── ch12-foreignObject-files ├── foreignObject-labels-hover-effects.PNG ├── foreignObject-labels-hover-effects.svg ├── foreignObject-labels.PNG ├── foreignObject-labels.svg └── index.html ├── index.css └── index.html /README.md: -------------------------------------------------------------------------------- 1 | SVG Text Layout 2 | ========== 3 | 4 | 5 | This is the example code that accompanies _SVG Text Layout_ by Amelia Bellamy-Royds and Kurt Cagle. 6 | 7 | To view the files on the web, start with [the table of contents on GitHub Pages](http://oreillymedia.github.io/SVG_Text_Layout/). 8 | 9 | To download example code, click the **Download Zip** button in the sidebar. 10 | 11 | For more about the book, or to buy a copy, visit [the catalog page on oreilly.com](http://shop.oreilly.com/product/0636920043072.do). 12 | 13 | See an error, here or in the book? [Report it on our errata page](http://oreilly.com/catalog/errata.csp?isbn=0636920043072). For errors with the examples, you can also create an issue on the repository, or fork and send us a pull request. 14 | -------------------------------------------------------------------------------- /ch01-text-theory-files/Batillaria_multiformis_01_for_sale-enhance.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/Batillaria_multiformis_01_for_sale-enhance.JPG -------------------------------------------------------------------------------- /ch01-text-theory-files/Batillaria_multiformis_01_for_sale.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/Batillaria_multiformis_01_for_sale.JPG -------------------------------------------------------------------------------- /ch01-text-theory-files/CourierA.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/CourierA.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/CourierA/BMP-13px.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/CourierA/BMP-13px.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/CourierA/BMP-17px.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/CourierA/BMP-17px.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/CourierA/CourierA.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/CourierA/CourierA.xcf -------------------------------------------------------------------------------- /ch01-text-theory-files/CourierA/TTF-fitted-13px.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/CourierA/TTF-fitted-13px.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/CourierA/TTF-fitted-17px.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/CourierA/TTF-fitted-17px.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/CourierA/TTF-fitted-28px-anti-aliased.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/CourierA/TTF-fitted-28px-anti-aliased.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/CourierA/TTF.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/CourierA/TTF.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/File-Batillaria multiformis 01 for sale.JPG - Wikimedia Commons.url: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=https://commons.wikimedia.org/wiki/File:Batillaria_multiformis_01_for_sale.JPG 3 | -------------------------------------------------------------------------------- /ch01-text-theory-files/Jazz & Coffee Masako #7 - Flickr - Photo Sharing!.url: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=https://www.flickr.com/photos/guwashi999/3950127409/ 3 | -------------------------------------------------------------------------------- /ch01-text-theory-files/Sign - Flickr - Photo Sharing!.url: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=https://www.flickr.com/photos/61904084@N00/2586190801 3 | -------------------------------------------------------------------------------- /ch01-text-theory-files/char-vs-glyph.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/char-vs-glyph.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/char-vs-glyph.hires.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/char-vs-glyph.hires.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/char-vs-glyph.svg: -------------------------------------------------------------------------------- 1 | 5 | Characters versus Glyphs 6 | 36 | 37 | 38 | 39 | 43 | 44 | 45 | 46 | 47 | 49 | 50 | 51 | 52 | 53 | 54 | Characters are not Glyphs 56 | Characters are not Glyphs 58 | Characters are not Glyphs 60 | Characters are not Glyphs 62 | -------------------------------------------------------------------------------- /ch01-text-theory-files/font-families.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/font-families.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/font-families.hires.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/font-families.hires.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/font-families.svg: -------------------------------------------------------------------------------- 1 | 4 | Font Faces and Families 5 | 53 | 54 | 55 | 56 | 60 | 61 | 62 | 63 | 64 | 66 | 67 | 68 | 69 | พิมพ์ไทย 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /ch01-text-theory-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch01 Understanding Text Layout — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Understanding Text Layout

16 |

Chapter 1, Understanding Text Layout reviews the basics of laying out text in word processors and websites, and introduces much of the technical terminology used to describe text.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 41 |

Return to the main table of contents.

42 |
43 | 49 | 50 | -------------------------------------------------------------------------------- /ch01-text-theory-files/japanese-snails.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/japanese-snails.JPG -------------------------------------------------------------------------------- /ch01-text-theory-files/script-vs-lang.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/script-vs-lang.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/script-vs-lang.hires.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch01-text-theory-files/script-vs-lang.hires.PNG -------------------------------------------------------------------------------- /ch01-text-theory-files/script-vs-lang.svg: -------------------------------------------------------------------------------- 1 | 4 | Scripts versus Languages 5 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | 50 | 51 | 52 | 53 | Idem alphabetum, 55 | sed alia lingua 56 | The same alphabet, 58 | but a different language 59 | An aibítir céanna, 61 | ach le éagsúla teanga 62 | Bảng chữ cái giống nhau, 64 | nhưng một ngôn ngữ khác nhau 65 | -------------------------------------------------------------------------------- /ch02-text-basics-files/flower-heading.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch02-text-basics-files/flower-heading.PNG -------------------------------------------------------------------------------- /ch02-text-basics-files/flower-heading.svg: -------------------------------------------------------------------------------- 1 | 5 | Wood Lily 6 | 61 | 62 | 63 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 76 | 77 | 78 | 84 | 85 | 87 | 88 | 90 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 141 | 143 | 145 | 146 | 151 | 155 | 156 | 158 | 160 | 162 | 163 | 164 | 165 | 166 | Wood Lily 168 | Lilium montanum 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /ch02-text-basics-files/flower-labels-accessible.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch02-text-basics-files/flower-labels-accessible.PNG -------------------------------------------------------------------------------- /ch02-text-basics-files/flower.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch02-text-basics-files/flower.PNG -------------------------------------------------------------------------------- /ch02-text-basics-files/flower.svg: -------------------------------------------------------------------------------- 1 | 5 | Wood Lily 6 | 48 | 49 | 50 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 63 | 64 | 65 | 71 | 72 | 74 | 75 | 77 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 128 | 130 | 132 | 133 | 138 | 142 | 143 | 145 | 147 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /ch02-text-basics-files/font-size.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch02-text-basics-files/font-size.PNG -------------------------------------------------------------------------------- /ch02-text-basics-files/font-size.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | font-size and SVG Coordinate Systems 6 | 23 | 24 | 25 |

This is 6pt HTML text. 26 | It is very tiny and difficult to read.

27 | 28 | This is 6pt SVG text. 29 | This is also 6pt text. 31 | 32 | 33 | -------------------------------------------------------------------------------- /ch02-text-basics-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch02 SVG Text Basics — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

SVG Text Basics

16 |

Chapter 2 introduces the SVG <text> element and the basic attributes for positioning simple text labels within a graphic, including the particular issues of sizing text within a scalable coordinate system.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 65 |

Return to the main table of contents.

66 |
67 | 73 | 74 | -------------------------------------------------------------------------------- /ch02-text-basics-files/text-css-longhand.svg: -------------------------------------------------------------------------------- 1 | 4 | SVG Text using CSS 5 | 14 | 15 | SVG Text 16 | -------------------------------------------------------------------------------- /ch02-text-basics-files/text-css.svg: -------------------------------------------------------------------------------- 1 | 4 | SVG Text using CSS 5 | 12 | 13 | SVG Text 14 | -------------------------------------------------------------------------------- /ch02-text-basics-files/text-filter.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch02-text-basics-files/text-filter.PNG -------------------------------------------------------------------------------- /ch02-text-basics-files/text-filter.svg: -------------------------------------------------------------------------------- 1 | 4 | Filter Effects on SVG Text 5 | 14 | 15 | 16 | 18 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | SVG Text 34 | -------------------------------------------------------------------------------- /ch02-text-basics-files/text-labels.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch02-text-basics-files/text-labels.PNG -------------------------------------------------------------------------------- /ch02-text-basics-files/text-labels.svg: -------------------------------------------------------------------------------- 1 | 4 | SVG Shapes, Labelled 5 | 24 | 25 | 26 | 27 | Line 28 | 29 | 30 | 32 | Rectangle 33 | 34 | 35 | 36 | Circle 37 | 38 | 39 | 40 | Ellipse 41 | 42 | 43 | 44 | Polygon 45 | 46 | 47 | 49 | Polyline 50 | 51 | 52 | 53 | Path 54 | 55 | SVG Shapes 57 | -------------------------------------------------------------------------------- /ch02-text-basics-files/text-simple.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch02-text-basics-files/text-simple.PNG -------------------------------------------------------------------------------- /ch02-text-basics-files/text-simple.svg: -------------------------------------------------------------------------------- 1 | 4 | Basic SVG Text 5 | 6 | SVG Text 7 | -------------------------------------------------------------------------------- /ch02-text-basics-files/text-size.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch02-text-basics-files/text-size.PNG -------------------------------------------------------------------------------- /ch02-text-basics-files/text-size.svg: -------------------------------------------------------------------------------- 1 | 4 | Font-size and SVG Text 5 | 8 | 9 | SVG Text 10 | -------------------------------------------------------------------------------- /ch02-text-basics-files/text-styled.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch02-text-basics-files/text-styled.PNG -------------------------------------------------------------------------------- /ch02-text-basics-files/text-styled.svg: -------------------------------------------------------------------------------- 1 | 4 | Styled SVG Text 5 | 6 | SVG Text 13 | -------------------------------------------------------------------------------- /ch02-text-basics-files/text-transform.svg: -------------------------------------------------------------------------------- 1 | 4 | Basic SVG Text with Transforms 5 | 6 | SVG Text 7 | -------------------------------------------------------------------------------- /ch03-fill-stroke-files/currentColor-icon-oops.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch03-fill-stroke-files/currentColor-icon-oops.PNG -------------------------------------------------------------------------------- /ch03-fill-stroke-files/currentColor-icon-oops.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Color-Matching Icons 6 | 25 | 26 | 27 | 45 |

An external link with an informative icon, to the 46 | SVG 1.1 47 | 48 | 49 | (external link) 50 | 51 | 52 | specifications on the Web.

53 |

Or you can download the 54 | complete 55 | specifications as a single file 56 | 57 | 58 | (PDF file) 59 | 60 | .

61 | 62 | -------------------------------------------------------------------------------- /ch03-fill-stroke-files/currentColor-icon.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch03-fill-stroke-files/currentColor-icon.PNG -------------------------------------------------------------------------------- /ch03-fill-stroke-files/currentColor-icon.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Color-Matching Icons 6 | 25 | 26 | 27 | 47 |

An external link with an informative icon, to the 48 | SVG 1.1 49 | 50 | 51 | External link 52 | 53 | 54 | specifications on the Web.

55 |

Or you can download the 56 | complete specifications as a single file 58 | 59 | 60 | PDF file 61 | 62 | .

63 | 64 | -------------------------------------------------------------------------------- /ch03-fill-stroke-files/gradient-headings-tspan.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch03-fill-stroke-files/gradient-headings-tspan.PNG -------------------------------------------------------------------------------- /ch03-fill-stroke-files/gradient-headings-tspan.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SVG Gradient Text Headings 6 | 38 | 39 | 40 | 55 |

56 | Level 1 Heading 57 |

58 | 76 | 77 | -------------------------------------------------------------------------------- /ch03-fill-stroke-files/gradient-headings.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch03-fill-stroke-files/gradient-headings.PNG -------------------------------------------------------------------------------- /ch03-fill-stroke-files/gradient-headings.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SVG Gradient Text Headings 6 | 35 | 36 | 37 | 53 |

54 | Level 1 Heading 55 |

56 |

An introductory paragraph full of lots of interesting text, 57 | which goes on for a few lines to take up space. Plenty of 58 | space. Very interesting text. So interesting, you can’t 59 | wait to see: 60 |

61 |

62 | A subheading

63 |

Such excitement! Subheadings after headings. This must be 64 | a really interesting web page to require such exciting headings. 65 | We really ought to have another one, to finish things off. 66 |

67 |

68 | Another sub

69 |

There. Now this feels like a proper mock-up. You can really 70 | get the feeling of a full page outline, can’t you? 71 |

72 | 73 | -------------------------------------------------------------------------------- /ch03-fill-stroke-files/gradient-text.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch03-fill-stroke-files/gradient-text.PNG -------------------------------------------------------------------------------- /ch03-fill-stroke-files/gradient-text.svg: -------------------------------------------------------------------------------- 1 | 5 | Gradient-Filled Text 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | A Whiter Shade of Pale 18 | 19 | -------------------------------------------------------------------------------- /ch03-fill-stroke-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch03 Colorful Language — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Colorful Language

16 |

Chapter 3 briefly covers SVG’s fill and stroke properties for controlling the visual appearance of text.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 57 |

Return to the main table of contents.

58 |
59 | 65 | 66 | -------------------------------------------------------------------------------- /ch03-fill-stroke-files/stroked-headings.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch03-fill-stroke-files/stroked-headings.PNG -------------------------------------------------------------------------------- /ch03-fill-stroke-files/stroked-headings.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SVG Text Headings 6 | 31 | 32 | 33 |

34 | Level 1 Heading 35 |

36 |

An introductory paragraph full of lots of interesting text, 37 | which goes on for a few lines to take up space. Plenty of 38 | space. Very interesting text. So interesting, you can’t 39 | wait to see: 40 |

41 |

42 | A subheading

43 |

Such excitement! Subheadings after headings. This must be 44 | a really interesting web page to require such exciting headings. 45 | We really ought to have another one, to finish things off. 46 |

47 |

48 | Another sub

49 |

There. Now this feels like a proper mock-up. You can really 50 | get the feeling of a full page outline, can’t you? 51 |

52 | 53 | -------------------------------------------------------------------------------- /ch03-fill-stroke-files/tspan-formatting.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch03-fill-stroke-files/tspan-formatting.PNG -------------------------------------------------------------------------------- /ch03-fill-stroke-files/tspan-formatting.svg: -------------------------------------------------------------------------------- 1 | 3 | Formatting Text Spans 4 | 11 | 12 | One, 13 | Two, 14 | Three! 16 | 17 | -------------------------------------------------------------------------------- /ch04-position-tspan-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch04 Multiline SVG Text — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Multiline SVG Text

16 |

Chapter 4 gets into more complex text layouts, using formatted poetry as examples.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 45 |

Return to the main table of contents.

46 |
47 | 53 | 54 | -------------------------------------------------------------------------------- /ch04-position-tspan-files/little-crocodile.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch04-position-tspan-files/little-crocodile.PNG -------------------------------------------------------------------------------- /ch04-position-tspan-files/little-crocodile.svg: -------------------------------------------------------------------------------- 1 | 3 | How Doth the Little Crocodile - Lewis Carroll 4 | From Alice in Wonderland 5 | 23 | 24 | 25 | How doth the little crocodile 27 | Improve his shining tail, 29 | And pour the waters of the Nile 31 | On every golden scale! 33 | 34 | 35 | How cheerfully he seems to grin, 37 | How neatly spreads his claws, 39 | And welcomes little fishes in 41 | With gently smiling jaws! 43 | 44 | -------------------------------------------------------------------------------- /ch04-position-tspan-files/mouses-tale-re-position.svg: -------------------------------------------------------------------------------- 1 | 3 | The Mouse's Tale - Lewis Carroll 4 | From Alice in Wonderland 5 | 18 | 19 | Fury said to 20 | a mouse, That 21 | he met in the 22 | house, "Let 23 | us both go 24 | to law: 25 | I 26 | will prose- 27 | cute 28 | you. 29 | 30 | Come, I'll 31 | take no de- 32 | nial; We 33 | must have 34 | the trial: 35 | For really 36 | 37 | this morn- 38 | ing I've 39 | nothing 40 | to do." 41 | Said the 42 | mouse to 43 | the cur, 44 | 45 | "Such a 46 | trial, dear 47 | Sir, With 48 | no jury 49 | or judge 50 | would 51 | be wast- 52 | ing our 53 | 54 | breath." 55 | "I'll be 56 | judge, 57 | I'll be 58 | jury," 59 | said 60 | cun- 61 | ning 62 | 63 | old 64 | Fury: 65 | "I'll 66 | try 67 | the 68 | whole 69 | cause 70 | 71 | and 72 | condemn 73 | you to 74 | death!" 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 104 | -------------------------------------------------------------------------------- /ch04-position-tspan-files/mouses-tale.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch04-position-tspan-files/mouses-tale.PNG -------------------------------------------------------------------------------- /ch04-position-tspan-files/mouses-tale.svg: -------------------------------------------------------------------------------- 1 | 3 | The Mouse's Tale - Lewis Carroll 4 | From Alice in Wonderland 5 | 20 | 21 | Fury said to 22 | a mouse, That 23 | he met in the 24 | house, “Let 25 | us both go 26 | to law: 27 | I 28 | will prose- 29 | cute 30 | you. 31 | 32 | Come, I’ll 33 | take no de- 34 | nial; We 35 | must have 36 | the trial: 37 | For really 38 | 39 | this morn- 40 | ing I’ve 41 | nothing 42 | to do.” 43 | Said the 44 | mouse to 45 | the cur, 46 | 47 | “Such a 48 | trial, dear 49 | Sir, With 50 | no jury 51 | or judge 52 | would 53 | be wast- 54 | ing our 55 | 56 | breath.” 57 | “I’ll be 58 | judge, 59 | I’ll be 60 | jury,” 61 | said 62 | cun- 63 | ning 64 | 65 | old 66 | Fury: 67 | “I’ll 68 | try 69 | the 70 | whole 71 | cause 72 | 73 | and 74 | condemn 76 | you to 77 | death!” 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /ch04-position-tspan-files/tspan-position-absolute.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch04-position-tspan-files/tspan-position-absolute.PNG -------------------------------------------------------------------------------- /ch04-position-tspan-files/tspan-position-absolute.svg: -------------------------------------------------------------------------------- 1 | 3 | Positioning tspan 4 | 18 | 19 | One, 20 | Two, 21 | Three! 22 | 23 | -------------------------------------------------------------------------------- /ch04-position-tspan-files/tspan-position-percentage-bottom.svg: -------------------------------------------------------------------------------- 1 | 3 | Bottom-aligned tspan Position 4 | 18 | 19 | One, 20 | Two, 21 | Three! 22 | 23 | -------------------------------------------------------------------------------- /ch04-position-tspan-files/tspan-position-percentage-compare.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch04-position-tspan-files/tspan-position-percentage-compare.PNG -------------------------------------------------------------------------------- /ch04-position-tspan-files/tspan-position-percentage-compare.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SVG Resize Adjust 6 | 30 | 31 | 32 |
33 | 35 | 36 | 38 | 39 |
40 |
41 | 43 | 44 | 46 | 47 |
48 |
49 | 51 | 52 | 54 | 55 |
56 | 57 | -------------------------------------------------------------------------------- /ch04-position-tspan-files/tspan-position-percentage-offset.svg: -------------------------------------------------------------------------------- 1 | 3 | Centering tspan Position 4 | 18 | 19 | One, 20 | Two, 21 | Three! 22 | 23 | -------------------------------------------------------------------------------- /ch04-position-tspan-files/tspan-position-relative.svg: -------------------------------------------------------------------------------- 1 | 3 | Adjusting tspan Position 4 | 18 | 19 | One, 20 | Two, 21 | Three! 22 | 23 | -------------------------------------------------------------------------------- /ch05-position-char-files/bam-boom.FF.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch05-position-char-files/bam-boom.FF.PNG -------------------------------------------------------------------------------- /ch05-position-char-files/bam-boom.IE.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch05-position-char-files/bam-boom.IE.PNG -------------------------------------------------------------------------------- /ch05-position-char-files/bam-boom.gradients.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch05-position-char-files/bam-boom.gradients.PNG -------------------------------------------------------------------------------- /ch05-position-char-files/bam-boom.gradients.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch05-position-char-files/bam-boom.gradients.xcf -------------------------------------------------------------------------------- /ch05-position-char-files/bam-boom.svg: -------------------------------------------------------------------------------- 1 | 5 | Explosive Text 6 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | BAM! 40 | BOOM! 44 | 45 | -------------------------------------------------------------------------------- /ch05-position-char-files/character-position-relative.svg: -------------------------------------------------------------------------------- 1 | 3 | Relative Positioning of 4 | Individual Characters 5 | 12 | 13 | Wiggle 17 | -------------------------------------------------------------------------------- /ch05-position-char-files/character-position.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch05-position-char-files/character-position.PNG -------------------------------------------------------------------------------- /ch05-position-char-files/character-position.svg: -------------------------------------------------------------------------------- 1 | 3 | Positioning Individual Characters 4 | 11 | 12 | Wiggle 15 | -------------------------------------------------------------------------------- /ch05-position-char-files/character-rotation.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch05-position-char-files/character-rotation.PNG -------------------------------------------------------------------------------- /ch05-position-char-files/character-rotation.svg: -------------------------------------------------------------------------------- 1 | 3 | Rotating Individual Characters 4 | 11 | 12 | Jiggle 14 | giggle 15 | jig! 16 | 17 | -------------------------------------------------------------------------------- /ch05-position-char-files/character-tspan-position.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch05-position-char-files/character-tspan-position.PNG -------------------------------------------------------------------------------- /ch05-position-char-files/character-tspan-position.svg: -------------------------------------------------------------------------------- 1 | 3 | Character and tspan Position adjustments 4 | 18 | 19 | One, 22 | Two, 23 | Three! 26 | 27 | -------------------------------------------------------------------------------- /ch05-position-char-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch05 Off-Kilter Characters — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Off-Kilter Characters

16 |

Chapter 5 explores SVG’s ability to control the position and orientation of individual text characters.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 46 |

Return to the main table of contents.

47 |
48 | 54 | 55 | -------------------------------------------------------------------------------- /ch06-text-anchor-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch06 Casting Anchor — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Casting Anchor

16 |

Chapter 6 introduces the text-anchor property and discusses how it affects the alignment of text.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 37 |

Return to the main table of contents.

38 |
39 | 45 | 46 | -------------------------------------------------------------------------------- /ch06-text-anchor-files/text-anchor.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch06-text-anchor-files/text-anchor.PNG -------------------------------------------------------------------------------- /ch06-text-anchor-files/text-anchor.svg: -------------------------------------------------------------------------------- 1 | 5 | Anchoring SVG Text 6 | 11 | 12 | 13 | 14 | Start 16 | Middle 18 | End 20 | -------------------------------------------------------------------------------- /ch06-text-anchor-files/text-chunk-anchor-IE-test.svg: -------------------------------------------------------------------------------- 1 | 5 | Anchoring Custom-Positioned Text 6 | 11 | 12 | 13 | 15 | 16 | 17 | Anchor SVG 21 | 22 | 23 | 25 | 27 | -------------------------------------------------------------------------------- /ch06-text-anchor-files/text-chunk-anchor-dx.svg: -------------------------------------------------------------------------------- 1 | 5 | Anchoring Custom-Positioned Text 6 | 11 | 12 | 13 | 15 | 16 | 17 | Anchor 21 | SVG 22 | 23 | 24 | 26 | 28 | -------------------------------------------------------------------------------- /ch06-text-anchor-files/text-chunk-anchor-fix-whitespace.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch06-text-anchor-files/text-chunk-anchor-fix-whitespace.PNG -------------------------------------------------------------------------------- /ch06-text-anchor-files/text-chunk-anchor-fix-whitespace.svg: -------------------------------------------------------------------------------- 1 | 5 | Anchoring Custom-Positioned Text 6 | 11 | 12 | 13 | 15 | 16 | 17 | Anchor SVG 21 | 22 | 23 | 25 | 27 | -------------------------------------------------------------------------------- /ch06-text-anchor-files/text-chunk-anchor.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch06-text-anchor-files/text-chunk-anchor.PNG -------------------------------------------------------------------------------- /ch06-text-anchor-files/text-chunk-anchor.svg: -------------------------------------------------------------------------------- 1 | 5 | Anchoring Custom-Positioned Text 6 | 11 | 12 | 13 | 15 | 16 | 17 | Anchor 20 | SVG 21 | 22 | 23 | 25 | 27 | -------------------------------------------------------------------------------- /ch06-text-anchor-files/whitespace-test.svg: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | Left aligned 8 | with… spaces? 9 | 10 | 11 | Right aligned 12 | with… spaces? 13 | 14 | -------------------------------------------------------------------------------- /ch07-rtl-vertical-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch07 Anchoring in International Waters — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Anchoring in International Waters

16 |

Chapter 7 considers the particular issues of multidirectional text, including right-to-left horizontal text and vertical text.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 38 |

Return to the main table of contents.

39 |
40 | 46 | 47 | -------------------------------------------------------------------------------- /ch07-rtl-vertical-files/text-direction-2column.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Multilingual SVG Text Direction and Layout 6 | 34 | 35 | 36 | 95 | 96 | -------------------------------------------------------------------------------- /ch07-rtl-vertical-files/text-direction.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch07-rtl-vertical-files/text-direction.PNG -------------------------------------------------------------------------------- /ch07-rtl-vertical-files/text-direction.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Multilingual SVG Text Direction and Layout 6 | 34 | 35 | 36 | 91 | 92 | -------------------------------------------------------------------------------- /ch07-rtl-vertical-files/vertical-modes-fallback.Chrome.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch07-rtl-vertical-files/vertical-modes-fallback.Chrome.PNG -------------------------------------------------------------------------------- /ch07-rtl-vertical-files/vertical-modes-fallback.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch07-rtl-vertical-files/vertical-modes-fallback.PNG -------------------------------------------------------------------------------- /ch07-rtl-vertical-files/vertical-modes-fallback.svg: -------------------------------------------------------------------------------- 1 | 4 | Faking Vertical Writing Modes 5 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | Hi, SVG World! 23 | 24 | 25 | 您好SVG世界! 26 | 27 | 28 | 29 | Hi, SVG World! 32 | 33 | 34 | 您好SVG世界! 38 | 39 | 40 | 41 | Hi, SVG World! 47 | 48 | 49 | 您好SVG世界! 54 | 55 | 56 | 58 | 59 | 60 | 61 | 63 | 64 | Hi, SVG World! 69 | 70 | 71 | 您好SVG世界! 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /ch07-rtl-vertical-files/vertical-modes-future.svg: -------------------------------------------------------------------------------- 1 | 4 | Mixed Scripts and Writing Modes 5 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | Hi, SVG World! 29 | 30 | 31 | 您好SVG世界! 32 | 33 | 35 | 37 | 38 | 40 | 41 | 43 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /ch07-rtl-vertical-files/vertical-modes.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch07-rtl-vertical-files/vertical-modes.PNG -------------------------------------------------------------------------------- /ch07-rtl-vertical-files/vertical-modes.svg: -------------------------------------------------------------------------------- 1 | 4 | Mixed Scripts and Writing Modes 5 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | Hi, SVG World! 23 | 24 | 25 | 您好SVG世界! 26 | 27 | 29 | 31 | 32 | 34 | 35 | 37 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ch08-baselines-files/baseline-shift-fallback.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch08-baselines-files/baseline-shift-fallback.PNG -------------------------------------------------------------------------------- /ch08-baselines-files/baseline-shift-fallback.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | Faking Baseline Shift in SVG Text 5 | 21 | 22 | You’re 23 | as sweet as C6‌H12‌O6‌.(1) 28 | 29 | 30 | 31 | (1) 33 | Chemical signature of glucose sugar 34 | 35 | -------------------------------------------------------------------------------- /ch08-baselines-files/baseline-shift.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch08-baselines-files/baseline-shift.PNG -------------------------------------------------------------------------------- /ch08-baselines-files/baseline-shift.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | Baseline Shift in SVG Text 5 | 31 | 32 | You’re as sweet 33 | as C6H12O6.(1) 36 | 37 | 38 | (1) 40 | Chemical signature of glucose sugar 41 | 42 | -------------------------------------------------------------------------------- /ch08-baselines-files/baselines.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch08-baselines-files/baselines.PNG -------------------------------------------------------------------------------- /ch08-baselines-files/baselines.svg: -------------------------------------------------------------------------------- 1 | 4 | Text Baseline Comparison 5 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 'alphabetic' 32 | alignment您好 33 | 34 | 35 | 36 | 'middle' 37 | alignment您好 38 | 39 | 40 | 41 | 'hanging' 42 | alignment您好 43 | 44 | 45 | 46 | 'text-before-edge' 48 | alignment您好 49 | 50 | 51 | 52 | 53 | 54 | 55 | 'ideographic' 56 | alignment您好 57 | 58 | 59 | 60 | 'central' 61 | alignment您好 62 | 63 | 64 | 65 | 'mathematical' 66 | alignment您好 67 | 68 | 69 | 70 | 'text-after-edge' 72 | alignment您好 73 | 74 | 75 | -------------------------------------------------------------------------------- /ch08-baselines-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch08 Lining Up — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Lining Up

16 |

Chapter 8 introduces the properties that control the vertical alignment of horizontal text and the horizontal alignment of vertical text.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 37 |

Return to the main table of contents.

38 |
39 | 45 | 46 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-text-absolute.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch09-textPath-files/circle-text-absolute.PNG -------------------------------------------------------------------------------- /ch09-textPath-files/circle-text-absolute.svg: -------------------------------------------------------------------------------- 1 | 5 | Text Positioned in a Curve 6 | 13 | 14 | 15 | Sunrise 19 | 20 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-arabic-centered.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch09-textPath-files/circle-textPath-arabic-centered.PNG -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-arabic-centered.svg: -------------------------------------------------------------------------------- 1 | 4 | Arabic Text on a Curved Path 5 | 18 | 19 | 21 | 22 | جميل الخط النسخية على منحنى 24 | 25 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-arabic-centered.zoom.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch09-textPath-files/circle-textPath-arabic-centered.zoom.PNG -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-arabic-flat.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch09-textPath-files/circle-textPath-arabic-flat.PNG -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-arabic-flat.svg: -------------------------------------------------------------------------------- 1 | 4 | Arabic Text on a Curved Path 5 | 12 | 13 | 15 | 16 | جميل الخط النسخية على منحنى 18 | 19 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-arabic-styled.svg: -------------------------------------------------------------------------------- 1 | 4 | Arabic Text on a Curved Path 5 | 15 | 16 | 18 | 19 | جميل 21 | الخط النسخية 22 | على منحنى 23 | 24 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-arabic.svg: -------------------------------------------------------------------------------- 1 | 2 | 5 | Arabic Text on a Curved Path 6 | 20 | 21 | 23 | 24 | جميل الخط النسخية على منحنى 26 | 27 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-centered-xy.svg: -------------------------------------------------------------------------------- 1 | 5 | Centered Text on a Curved Path 6 | 16 | 17 | 19 | 20 | from 22 | Sunrise 23 | to 24 | Sunset 25 | and back again 26 | 27 | 28 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-centered.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch09-textPath-files/circle-textPath-centered.PNG -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-centered.svg: -------------------------------------------------------------------------------- 1 | 5 | Centered Text on a Curved Path 6 | 13 | 14 | 16 | 17 | from Sunrise to Sunset 19 | 20 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-dy.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch09-textPath-files/circle-textPath-dy.PNG -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-dy.svg: -------------------------------------------------------------------------------- 1 | 5 | Text Offset from a Curved Path 6 | 16 | 17 | 19 | 20 | from 22 | Sunrise 24 | to 25 | Sunset 27 | 28 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-hebrew-centered.svg: -------------------------------------------------------------------------------- 1 | 4 | Hebrew Text on a Curved Path 5 | 12 | 13 | 15 | 16 | טכסט כתוב בעברית 18 | 19 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-hebrew-end.svg: -------------------------------------------------------------------------------- 1 | 4 | Hebrew Text on a Curved Path 5 | 12 | 13 | 15 | 16 | טכסט כתוב בעברית 18 | 19 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-hebrew.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch09-textPath-files/circle-textPath-hebrew.PNG -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-hebrew.svg: -------------------------------------------------------------------------------- 1 | 4 | Hebrew Text on a Curved Path 5 | 12 | 13 | 15 | 16 | טכסט כתוב בעברית 18 | 19 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-multiline.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch09-textPath-files/circle-textPath-multiline.PNG -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-multiline.svg: -------------------------------------------------------------------------------- 1 | 5 | Multiline Text on a Curved Path 6 | 13 | 14 | 16 | 17 | Text above a path 20 | and below it, too! 23 | 24 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-rotated.svg: -------------------------------------------------------------------------------- 1 | 5 | Styled Text on a Curved Path 6 | 16 | 17 | 19 | 20 | from 22 | Sunrise 23 | to 24 | Sunset 26 | 27 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-styled.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch09-textPath-files/circle-textPath-styled.PNG -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-styled.svg: -------------------------------------------------------------------------------- 1 | 5 | Styled Text on a Curved Path 6 | 16 | 17 | 19 | 20 | from 22 | Sunrise 23 | to 24 | Sunset 26 | 27 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath-xy.svg: -------------------------------------------------------------------------------- 1 | 5 | Multiline Text on a Curved Path 6 | 16 | 17 | 19 | 20 | from 21 | Sunrise 22 | to 23 | Sunset 24 | and back again 25 | 26 | 27 | -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch09-textPath-files/circle-textPath.PNG -------------------------------------------------------------------------------- /ch09-textPath-files/circle-textPath.svg: -------------------------------------------------------------------------------- 1 | 5 | Text on a Curved Path 6 | 13 | 14 | 16 | 17 | from Sunrise 18 | to Sunset 19 | 20 | -------------------------------------------------------------------------------- /ch09-textPath-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch09 Beyond Straight Lines — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Beyond Straight Lines

16 |

Chapter 9 looks at the <textPath> element and how it can be used to create curved or complex text layouts.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 60 |

Return to the main table of contents.

61 |
62 | 68 | 69 | -------------------------------------------------------------------------------- /ch09-textPath-files/textPath-startOffset.svg: -------------------------------------------------------------------------------- 1 | 5 | Text on a Path -- Start Offset 6 | 7 | 9 | 10 | Text on a Path 11 | Text on a Path 13 | 14 | -------------------------------------------------------------------------------- /ch09-textPath-files/walrus-carpenter.svg: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | 14 | 15 | "The time has come," the Walrus said, "to talk of many things. Of shoes, and ships and sealing wax, of cabbages and kings. And why the sea is boiling hot, and whether pigs have wings. 16 | 17 | 18 | 19 | "The time has come," the Walrus said, "to talk of many things. Of shoes, and ships and sealing wax, of cabbages and kings. And why the sea is boiling hot, and whether pigs have wings. 20 | 21 | -------------------------------------------------------------------------------- /ch10-fonts-files/bam-boom-comparison.Arial.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/bam-boom-comparison.Arial.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/bam-boom-comparison.Cooper.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/bam-boom-comparison.Cooper.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/bam-boom-comparison.GillSans.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/bam-boom-comparison.GillSans.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/bam-boom-comparison.Goudy.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/bam-boom-comparison.Goudy.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/bam-boom-comparison.Impact.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/bam-boom-comparison.Impact.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/bam-boom-comparison.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/bam-boom-comparison.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/bam-boom-comparison.Showcard.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/bam-boom-comparison.Showcard.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/bam-boom-comparison.hi-res.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/bam-boom-comparison.hi-res.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/bam-boom-comparison.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/bam-boom-comparison.xcf -------------------------------------------------------------------------------- /ch10-fonts-files/bam-boom-postscript-names.svg: -------------------------------------------------------------------------------- 1 | 5 | Explosive Text 6 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | BAM! 47 | BOOM! 51 | 52 | -------------------------------------------------------------------------------- /ch10-fonts-files/generic-fonts-cursive.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/generic-fonts-cursive.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/generic-fonts-cursive.svg: -------------------------------------------------------------------------------- 1 | 4 | Cursive font families 5 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | Hello, World! 45 | Hello, World! 47 | Hello, World! 49 | Hello, World! 51 | 52 | 53 | -------------------------------------------------------------------------------- /ch10-fonts-files/generic-fonts-fantasy.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/generic-fonts-fantasy.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/generic-fonts-fantasy.svg: -------------------------------------------------------------------------------- 1 | 4 | Fantasy font families 5 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | Hello, World! 45 | Hello, World! 47 | Hello, World! 49 | Hello, World! 51 | 52 | 53 | -------------------------------------------------------------------------------- /ch10-fonts-files/generic-fonts-monospace.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/generic-fonts-monospace.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/generic-fonts-monospace.svg: -------------------------------------------------------------------------------- 1 | 4 | Monospace font families 5 | for various scripts 6 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | Hello, World! 44 | Привет мир! 46 | שלום העולם! 48 | مرحبا أيها العالم! 50 | 51 | -------------------------------------------------------------------------------- /ch10-fonts-files/generic-fonts-sans-serif.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/generic-fonts-sans-serif.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/generic-fonts-sans-serif.svg: -------------------------------------------------------------------------------- 1 | 4 | Sans-serif font families 5 | for various scripts 6 | 37 | 40 | 41 | 42 | 43 | 44 | 45 | Hello, World! 47 | Привет мир! 49 | שלום העולם! 51 | مرحبا أيها العالم! 53 | 你好! 55 | 56 | -------------------------------------------------------------------------------- /ch10-fonts-files/generic-fonts-serif.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/generic-fonts-serif.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/generic-fonts-serif.svg: -------------------------------------------------------------------------------- 1 | 4 | Serif font families 5 | for various scripts 6 | 37 | 40 | 41 | 42 | 43 | 44 | 45 | Hello, World! 47 | Привет мир! 49 | שלום העולם! 51 | مرحبا أيها العالم! 53 | 你好! 55 | 56 | -------------------------------------------------------------------------------- /ch10-fonts-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch10 Fonts, Fimilies, Faces — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Fonts, Families, Faces

16 |

Chapter 10 explores fonts and their impact on SVG text, including the use of the @font-face rule to incorporate web fonts in your SVG graphics online.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 46 |

Return to the main table of contents.

47 |
48 | 54 | 55 | -------------------------------------------------------------------------------- /ch10-fonts-files/penpal-fonts.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch10-fonts-files/penpal-fonts.PNG -------------------------------------------------------------------------------- /ch10-fonts-files/penpal-fonts.svg: -------------------------------------------------------------------------------- 1 | 4 | Dear Pen Pal 5 | 35 | 36 | 37 | 38 | 39 | 41 | 42 | 43 | Dear Pen Pal, 45 | 46 | Today, I received a 47 | new letter from my 48 | pen pal. Hooray! 49 | 50 | Sincerely, 52 | Me 53 | 54 | 55 | -------------------------------------------------------------------------------- /ch11-size-adjust-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch11 The Perfect Fit — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

The Perfect Fit

16 |

Chapter 11 looks at the textLength attribute and font-size-adjust property, which can be used to standardize text layout when you don’t have full control over the fonts used; the chapter also describes decorative uses for textLength.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 37 |

Return to the main table of contents.

38 |
39 | 45 | 46 | -------------------------------------------------------------------------------- /ch11-size-adjust-files/lengthAdjust.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch11-size-adjust-files/lengthAdjust.PNG -------------------------------------------------------------------------------- /ch11-size-adjust-files/lengthAdjust.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SVG lengthAdjust for Graphical Effect 6 | 44 | 45 | 46 | 47 | 48 | 53 | 55 | 56 | 57 | 62 | 63 | 64 | 65 | 70 | 71 | 72 |
49 | This text is too long 52 | Look! Each heading has the 54 | same length.
58 | Short 61 | Cool effect, don't you think?
66 | Just Right 69 | They compress on smaller screens, too!
73 | 74 | -------------------------------------------------------------------------------- /ch11-size-adjust-files/penpal-font-adjust-comparison.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch11-size-adjust-files/penpal-font-adjust-comparison.PNG -------------------------------------------------------------------------------- /ch11-size-adjust-files/penpal-font-adjust-comparison.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch11-size-adjust-files/penpal-font-adjust-comparison.xcf -------------------------------------------------------------------------------- /ch11-size-adjust-files/penpal-font-adjust-fallback-no-adjust.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch11-size-adjust-files/penpal-font-adjust-fallback-no-adjust.PNG -------------------------------------------------------------------------------- /ch11-size-adjust-files/penpal-font-adjust-fallback.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch11-size-adjust-files/penpal-font-adjust-fallback.PNG -------------------------------------------------------------------------------- /ch11-size-adjust-files/penpal-font-adjust-no-adjust.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch11-size-adjust-files/penpal-font-adjust-no-adjust.PNG -------------------------------------------------------------------------------- /ch11-size-adjust-files/penpal-font-adjust.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch11-size-adjust-files/penpal-font-adjust.PNG -------------------------------------------------------------------------------- /ch11-size-adjust-files/penpal-font-adjust.svg: -------------------------------------------------------------------------------- 1 | 4 | Dear Pen Pal 5 | 37 | 38 | 39 | 40 | 41 | 43 | 44 | 45 | Dear Pen Pal, 47 | Today, I received a 49 | new letter from my 51 | pen pal. Hooray! 53 | Sincerely, 55 | Me 56 | 57 | 58 | -------------------------------------------------------------------------------- /ch11-size-adjust-files/penpal-fonts-fallback-comparison.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch11-size-adjust-files/penpal-fonts-fallback-comparison.PNG -------------------------------------------------------------------------------- /ch11-size-adjust-files/penpal-fonts-fallback-comparison.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch11-size-adjust-files/penpal-fonts-fallback-comparison.xcf -------------------------------------------------------------------------------- /ch11-size-adjust-files/penpal-fonts-fallback.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch11-size-adjust-files/penpal-fonts-fallback.PNG -------------------------------------------------------------------------------- /ch12-foreignObject-files/foreignObject-labels-hover-effects.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch12-foreignObject-files/foreignObject-labels-hover-effects.PNG -------------------------------------------------------------------------------- /ch12-foreignObject-files/foreignObject-labels-hover-effects.svg: -------------------------------------------------------------------------------- 1 | 3 | Interactive ForeignObjects describing SVG Shapes 4 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Line 66 | 67 | 69 |

The <line> element draws 70 | a straight line defined by its start and 71 | end points.

72 | 73 |
74 |
75 | 76 | 78 | Rectangle 79 | 80 | 82 |

The <rect> element draws 83 | a rectangle, optionally with rounded 84 | corners.

85 | 86 |
87 |
88 | 89 | 90 | Circle 91 | 92 | 94 |

The <circle> element draws 95 | a circle defined by its center-point and 96 | radius.

97 | 98 |
99 |
100 | 101 | 102 | Ellipse 103 | 104 | 106 |

The <ellipse> element draws 107 | an ellipse, which is like a stretched circle 108 | or a rectangle with rounded corners that meet 109 | in the middle.

110 | 111 |
112 |
113 | 114 | 115 | Polygon 116 | 117 | 119 |

The <polygon> element draws 120 | a custom shape by connecting a series of 121 | points.

122 | 123 |
124 |
125 | 126 | 128 | Polyline 129 | 130 | 132 |

The <polyline> element 133 | also connects a series of points, 134 | but does not insert a final stroke from the 135 | last point to the first.

136 | 137 |
138 |
139 | 140 | 141 | Path 142 | 143 | 145 |

The <path> element 146 | can be used to draw any of the above, 147 | or to create a custom shape with a mixture 148 | of lines, Bézier curves, and arcs.

149 | 150 |
151 |
152 | SVG Shapes 156 |
-------------------------------------------------------------------------------- /ch12-foreignObject-files/foreignObject-labels.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oreillymedia/SVG_Text_Layout/58d970f3d73359c543eeb05bf7d79c008b64826a/ch12-foreignObject-files/foreignObject-labels.PNG -------------------------------------------------------------------------------- /ch12-foreignObject-files/foreignObject-labels.svg: -------------------------------------------------------------------------------- 1 | 3 | ForeignObjects describing SVG Shapes 4 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | Line 54 | 55 | 57 |

The <line> element draws 58 | a straight line defined by its start and 59 | end points.

60 | 61 |
62 |
63 | 64 | 66 | Rectangle 67 | 68 | 70 |

The <rect> element draws 71 | a rectangle, optionally with rounded 72 | corners.

73 | 74 |
75 |
76 | 77 | 78 | Circle 79 | 80 | 82 |

The <circle> element draws 83 | a circle defined by its center-point and 84 | radius.

85 | 86 |
87 |
88 | 89 | 90 | Ellipse 91 | 92 | 94 |

The <ellipse> element draws 95 | an ellipse, which is like a stretched circle 96 | or a rectangle with rounded corners that meet 97 | in the middle.

98 | 99 |
100 |
101 | 102 | 103 | Polygon 104 | 105 | 107 |

The <polygon> element draws 108 | a custom shape by connecting a series of 109 | points.

110 | 111 |
112 |
113 | 114 | 116 | Polyline 117 | 118 | 120 |

The <polyline> element 121 | also connects a series of points, 122 | but does not insert a final stroke from the 123 | last point to the first.

124 | 125 |
126 |
127 | 128 | 129 | Path 130 | 131 | 133 |

The <path> element 134 | can be used to draw any of the above, 135 | or to create a custom shape with a mixture 136 | of lines, Bézier curves, and arcs.

137 | 138 |
139 |
140 | SVG Shapes 144 |
-------------------------------------------------------------------------------- /ch12-foreignObject-files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ch12 Extending Your Toolbox — Supplementary Material: SVG Text Layout 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Extending Your Toolbox

16 |

Chapter 12 introduces the SVG <foreignObject> element, and shows how it can be used to include CSS-formatted HTML text within an SVG image.

17 |

18 | The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code. 19 |

20 | 32 |

Return to the main table of contents.

33 |
34 | 40 | 41 | -------------------------------------------------------------------------------- /index.css: -------------------------------------------------------------------------------- 1 | html { 2 | background-color: #ffd; 3 | background: linear-gradient(-45deg, #ffd, #fea, #ffd 140vw); 4 | min-height: 100%; 5 | } 6 | body { 7 | margin: auto; 8 | padding: 0; 9 | } 10 | header, footer, main { 11 | display: block; 12 | padding: 0.5em 1em; 13 | } 14 | @media (max-width: 25em) { 15 | header, footer, main { 16 | padding: 0.3em; 17 | } 18 | main > ul { 19 | padding-left: 1em; 20 | } 21 | } 22 | header, footer { 23 | font-family: Georgia, serif; 24 | font-style: italic; 25 | font-size: 1.2rem; 26 | color: #216; 27 | } 28 | header p, footer p { 29 | margin: 0.2em auto; 30 | line-height: 1.2; 31 | } 32 | header h1 { 33 | margin: 0.5em 0; 34 | text-shadow: 1.5px 1px #b8a; 35 | } 36 | footer { 37 | border-top: solid thin currentColor; 38 | } 39 | 40 | main { 41 | font-family: Tahoma, sans-serif; 42 | font-size: 1.2rem; 43 | line-height: 1.2; 44 | color: #302; 45 | } 46 | main h1 { 47 | text-shadow: 1.5px 1px #e86; 48 | } 49 | main > *, footer { 50 | max-width: 40rem; 51 | margin: 1rem auto; 52 | } 53 | li { 54 | margin-bottom: 1em; 55 | margin-left: 0.5em; 56 | list-style-image: radial-gradient(closest-side, 57 | #606, #302 98%, transparent 100%); 58 | } 59 | li ul { 60 | padding-left: 1.5em; 61 | } 62 | li li { 63 | margin: 0.1em; 64 | list-style-image: radial-gradient(closest-side, 65 | #b8a, #606 98%, transparent 100%); 66 | } 67 | 68 | :link, :link * { 69 | color: #129; 70 | text-decoration-style: dotted; 71 | } 72 | :visited { 73 | color: #606; 74 | } 75 | header :link, header :visited { 76 | color: inherit; 77 | text-decoration: none; 78 | } 79 | code { 80 | font-family: DejaVu Sans Mono, monospace; 81 | } 82 | 83 | @media (min-width: 52em) { 84 | main > ul { 85 | max-width: 100%; 86 | box-sizing: border-box; 87 | margin: 1em 0; 88 | -moz-column-width: 25em; 89 | -webkit-column-width: 25em; 90 | column-width: 25em; 91 | -moz-column-gap: 2em; 92 | -webkit-column-gap: 2em; 93 | column-gap: 2em; 94 | } 95 | li { 96 | page-break-inside: avoid; /* used for columns by Firefox */ 97 | -webkit-column-break-inside: avoid; 98 | break-inside: avoid; 99 | } 100 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SVG Text Layout: Supplementary Material 5 | 6 | 7 | 8 | 9 |
10 |

SVG Text Layout

11 |

Example code for the O’Reilly Media book

12 |

by Amelia Bellamy-Royds & Kurt Cagle

13 |
14 |
15 |

Overview

16 |

17 | SVG Text Layout takes an in-depth look at how complex text layouts can be created with SVG markup and styles. The many examples demonstrate the concepts with stand-alone SVG graphics or inline SVG code in HTML pages. 18 |

19 |

The authors have made all the example code and screenshots available as a reference repository. These files are covered by the O’Reilly Media policy on the use of example code. Short version: you are free to use the examples in moderation; credit is appreciated but not required. However, please don't integrate a large portion of the example set within a product or documentation. 20 |

21 |

22 | The chapter links in the following outline will take you to an index of the examples and figures as SVG files you can view live in your browser. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. 23 |

24 | 25 | 63 | 64 |
65 | 71 | 72 | 73 | --------------------------------------------------------------------------------