You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 986a85d
Browse filesBrowse the repository at this point in the historyBrowse files
Text, tspan, tref and textPath elements render with the fonts given as
SVGOptions.fonts and the ones the SVG embeds with @font-face (TrueType,
OpenType, WOFF in data: URIs). Fonts are matched by CSS Fonts' algorithm
from the names, weights and styles in them; generic families take the
first font fitting them.
The layout follows usvg (src/render/svg-text.ts): whitespace, position and
rotation lists, chunks shaped as a whole with each span's font, fallback
fonts per grapheme, letter and word spacing, textLength, anchors,
baselines, decorations, text paths with kurbo's arc lengths, vertical
text, and COLR, CBDT, sbix and SVG color glyphs. Text is painted like
shapes with the text's bounding box, and counts in clip paths and group
bounding boxes.
Also: font-size resolves relative values against the parent's size,
font-weight bolder and lighter, the font shorthand, declarations keep
semicolons in parentheses, and a synchronous PNG decode for bitmap glyphs.
359 of resvg's 431 text tests pass with its test fonts (subset into
tests/fonts/resvg by scripts/resvg-test-fonts.py), and 41 more of its
other tests with text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lfv41PqHEGbU7SLg5onpG1
|[HarfBuzz](https://github.com/harfbuzz/harfbuzz)|`src/render/buffer.ts`, `src/render/layout.ts`, `src/render/shape.ts`, `src/render/shapers/*` (OpenType shaping: buffer, GSUB/GPOS, normalization, fallback positioning, the script shapers and syllable grammars), `scripts/unicode.js` (shaping category tables) | Old MIT |
27
27
|[Universal Shaping Engine data](https://github.com/harfbuzz/harfbuzz/tree/main/src/ms-use) by Microsoft |`scripts/ms-use` (category overrides, invalid vowel sequences), the tables generated from them in `src/render/unicode-data.ts`| MIT |
28
-
|[resvg](https://github.com/linebender/resvg) by the Resvg Authors |`src/render/filter.ts` (the filter effects: regions, inputs, color spaces, box blur (based on [fastblur](https://github.com/fschutt/fastblur)), IIR blur, offset, flood, composite, merge, drop shadow, color matrix, component transfer, tile, morphology, convolution), `src/render/svg.ts` (the filters' attributes like usvg; how patterns are rendered and their reference cycles broken, following resvg and usvg; the markers' placement and orientation, ported from usvg; as many cubics per arc as kurbo makes for usvg; how images are fitted, clipped and sampled; transform-origin, paint-order, context-fill and context-stroke, mix-blend-mode and isolation, following usvg), `tests/svgs/resvg` (test cases with resvg's renderings) | MIT (or Apache-2.0) |
28
+
| [resvg](https://github.com/linebender/resvg) by the Resvg Authors | `src/render/filter.ts` (the filter effects: regions, inputs, color spaces, box blur (based on [fastblur](https://github.com/fschutt/fastblur)), IIR blur, offset, flood, composite, merge, drop shadow, color matrix, component transfer, tile, morphology, convolution), `src/render/svg.ts` (the filters' attributes like usvg; how patterns are rendered and their reference cycles broken, following resvg and usvg; the markers' placement and orientation, ported from usvg; as many cubics per arc as kurbo makes for usvg; how images are fitted, clipped and sampled; transform-origin, paint-order, context-fill and context-stroke, mix-blend-mode and isolation, following usvg; how text elements are read: whitespace, positions, chunks, spans, decorations, baseline shifts, text paths, as in usvg), `src/render/svg-text.ts` (text layout ported from usvg: shaping across spans, spacing, text length, anchors, positions along paths, baselines, decorations, vertical text, color glyphs' placement), `tests/svgs/resvg` (test cases with resvg's renderings) | MIT (or Apache-2.0) |
29
+
| resvg's test fonts: [Noto](https://notofonts.github.io) fonts by Google, [Amiri](https://github.com/aliftype/amiri) by Khaled Hosny, [M+](https://mplusfonts.github.io) by the M+ Fonts Project, [Sedgwick Ave Display](https://github.com/googlefonts/sedgwickave) by Kevin Burke, [Source Sans Pro](https://github.com/adobe-fonts/source-sans) by Adobe, [Yellowtail](https://fonts.google.com/specimen/Yellowtail) by Astigmatic, [Twemoji](https://github.com/twitter/twemoji) by Twitter, a CFF and sbix test font of resvg |`tests/fonts/resvg` (subsets, see `scripts/resvg-test-fonts.py`; their licenses are next to them) | OFL-1.1, Apache-2.0, MIT, CC-BY 4.0 (Twemoji's graphics) |
30
+
|[fontdb](https://github.com/RazrFalcon/fontdb) by Yevhenii Reizner |`src/render/svg-text.ts` (font matching: CSS Fonts' algorithm as fontdb's queries do it, the fallback's style check) | MIT |
31
+
|[kurbo](https://github.com/linebender/kurbo) by Raph Levien |`src/render/svg-text.ts` (arc lengths of cubics: adaptive Legendre-Gauss quadrature; parameters at arc lengths: the ITP method) | MIT (or Apache-2.0) |
29
32
|[tiny-skia](https://github.com/linebender/tiny-skia) by Yevhenii Reizner (from [Skia](https://skia.org) by Google) |`src/render/blend.ts` (the blend modes of feBlend and mix-blend-mode) | BSD-3-Clause |
30
33
|[gaussianiir](http://www.getreuer.info/home/gaussianiir) by Pascal Getreuer |`src/render/filter.ts` (the IIR blur for small deviations, through resvg) | BSD-2-Clause (Simplified BSD) |
31
34
|[Unicode Character Database](https://www.unicode.org/ucd/)|`src/render/unicode-data.ts` (character properties, generated by `scripts/unicode.js`) | Unicode License v3 |
@@ -523,6 +526,62 @@ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
523
526
DEALINGS IN THE SOFTWARE.
524
527
```
525
528
529
+
## fontdb
530
+
531
+
```
532
+
The MIT License (MIT)
533
+
534
+
Copyright (c) 2020 Yevhenii Reizner
535
+
536
+
Permission is hereby granted, free of charge, to any person obtaining a copy
537
+
of this software and associated documentation files (the "Software"), to deal
538
+
in the Software without restriction, including without limitation the rights
539
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
540
+
copies of the Software, and to permit persons to whom the Software is
541
+
furnished to do so, subject to the following conditions:
542
+
543
+
The above copyright notice and this permission notice shall be included in all
544
+
copies or substantial portions of the Software.
545
+
546
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
547
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
548
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
549
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
550
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
551
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
552
+
SOFTWARE.
553
+
```
554
+
555
+
## kurbo
556
+
557
+
```
558
+
Copyright (c) 2018 Raph Levien
559
+
560
+
Permission is hereby granted, free of charge, to any
561
+
person obtaining a copy of this software and associated
562
+
documentation files (the "Software"), to deal in the
563
+
Software without restriction, including without
564
+
limitation the rights to use, copy, modify, merge,
565
+
publish, distribute, sublicense, and/or sell copies of
566
+
the Software, and to permit persons to whom the Software
567
+
is furnished to do so, subject to the following
568
+
conditions:
569
+
570
+
The above copyright notice and this permission notice
571
+
shall be included in all copies or substantial portions
572
+
of the Software.
573
+
574
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
575
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
576
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
577
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
578
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
579
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
580
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
581
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
0 commit comments