fontisan 0.2.14 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +79 -4
- data/Gemfile +6 -3
- data/docs/.gitignore +17 -0
- data/docs/.vitepress/config.ts +317 -0
- data/docs/.vitepress/theme/components/ApiMethod.vue +127 -0
- data/docs/.vitepress/theme/components/Badge.vue +51 -0
- data/docs/.vitepress/theme/components/FeatureComparison.vue +87 -0
- data/docs/.vitepress/theme/components/HeroCodeBlock.vue +98 -0
- data/docs/.vitepress/theme/components/WithinHero.vue +30 -0
- data/docs/.vitepress/theme/index.ts +22 -0
- data/docs/.vitepress/theme/style.css +330 -0
- data/docs/api/conversion-options.md +141 -0
- data/docs/api/converters/curve-converter.md +34 -0
- data/docs/api/converters/hint-converter.md +34 -0
- data/docs/api/converters/outline-converter.md +27 -0
- data/docs/api/font-loader.md +117 -0
- data/docs/api/font-writer.md +103 -0
- data/docs/api/index.md +79 -0
- data/docs/api/models/glyph-accessor.md +43 -0
- data/docs/api/models/glyph.md +40 -0
- data/docs/api/models/table-analyzer.md +35 -0
- data/docs/api/sfnt-font.md +53 -0
- data/docs/api/type1-font.md +43 -0
- data/docs/api/validators/font-validator.md +31 -0
- data/docs/api/validators/helper.md +36 -0
- data/docs/api/validators/profile.md +39 -0
- data/docs/cli/convert.md +87 -0
- data/docs/cli/dump-table.md +110 -0
- data/docs/cli/export.md +176 -0
- data/docs/cli/features.md +124 -0
- data/docs/cli/glyphs.md +90 -0
- data/docs/cli/index.md +208 -0
- data/docs/cli/info.md +254 -0
- data/docs/cli/instance.md +122 -0
- data/docs/cli/ls.md +95 -0
- data/docs/cli/optical-size.md +94 -0
- data/docs/cli/pack.md +125 -0
- data/docs/cli/scripts.md +105 -0
- data/docs/cli/subset.md +39 -0
- data/docs/cli/tables.md +84 -0
- data/docs/cli/unicode.md +101 -0
- data/docs/cli/validate.md +48 -0
- data/docs/cli/variable.md +126 -0
- data/docs/cli/version.md +46 -0
- data/docs/guide/cli/convert.md +108 -0
- data/docs/guide/cli/export.md +138 -0
- data/docs/guide/cli/index.md +99 -0
- data/docs/guide/cli/info.md +144 -0
- data/docs/guide/cli/pack.md +155 -0
- data/docs/guide/cli/subset.md +118 -0
- data/docs/guide/cli/validate.md +139 -0
- data/docs/guide/color-fonts/bitmaps.md +177 -0
- data/docs/guide/color-fonts/colr-cpal.md +175 -0
- data/docs/guide/color-fonts/index.md +140 -0
- data/docs/guide/color-fonts/svg.md +154 -0
- data/docs/guide/color.md +51 -0
- data/docs/guide/comparisons/font-validator.md +222 -0
- data/docs/guide/comparisons/fonttools.md +200 -0
- data/docs/guide/comparisons/index.md +83 -0
- data/docs/guide/comparisons/lcdf-typetools.md +205 -0
- data/docs/guide/contributing.md +279 -0
- data/docs/guide/conversion/collections.md +251 -0
- data/docs/guide/conversion/curves.md +246 -0
- data/docs/guide/conversion/index.md +157 -0
- data/docs/guide/conversion/options.md +251 -0
- data/docs/guide/conversion/ttf-otf.md +184 -0
- data/docs/guide/conversion/type1.md +208 -0
- data/docs/guide/conversion/web.md +240 -0
- data/docs/guide/conversion.md +39 -0
- data/docs/guide/formats/collections.md +147 -0
- data/docs/guide/formats/dfont.md +99 -0
- data/docs/guide/formats/index.md +65 -0
- data/docs/guide/formats/otf.md +103 -0
- data/docs/guide/formats/svg.md +97 -0
- data/docs/guide/formats/ttf.md +105 -0
- data/docs/guide/formats/type1.md +118 -0
- data/docs/guide/formats/woff.md +115 -0
- data/docs/guide/hinting/autohint.md +141 -0
- data/docs/guide/hinting/conversion.md +161 -0
- data/docs/guide/hinting/index.md +86 -0
- data/docs/guide/hinting/postscript.md +149 -0
- data/docs/guide/hinting/truetype.md +135 -0
- data/docs/guide/hinting.md +44 -0
- data/docs/guide/index.md +152 -0
- data/docs/guide/installation.md +116 -0
- data/docs/guide/migrations/extract-ttc.md +549 -0
- data/docs/guide/migrations/font-validator.md +260 -0
- data/docs/guide/migrations/fonttools.md +208 -0
- data/docs/guide/migrations/index.md +64 -0
- data/docs/guide/migrations/otfinfo.md +197 -0
- data/docs/guide/quick-start.md +204 -0
- data/docs/guide/type1.md +58 -0
- data/docs/guide/universal-outline.md +151 -0
- data/docs/guide/validation/custom.md +195 -0
- data/docs/guide/validation/helpers.md +188 -0
- data/docs/guide/validation/index.md +132 -0
- data/docs/guide/validation/profiles.md +156 -0
- data/docs/guide/validation.md +47 -0
- data/docs/guide/variable-fonts/advanced.md +231 -0
- data/docs/guide/variable-fonts/axes.md +209 -0
- data/docs/guide/variable-fonts/conversion.md +197 -0
- data/docs/guide/variable-fonts/index.md +84 -0
- data/docs/guide/variable-fonts/instances.md +187 -0
- data/docs/guide/variable-fonts/named-instances.md +194 -0
- data/docs/guide/variable-fonts/static.md +168 -0
- data/docs/guide/variable.md +58 -0
- data/docs/guide/woff.md +59 -0
- data/docs/index.md +136 -0
- data/docs/lychee.toml +37 -0
- data/docs/package-lock.json +2560 -0
- data/docs/package.json +15 -0
- data/docs/public/apple-touch-icon.png +0 -0
- data/docs/public/favicon-96x96.png +0 -0
- data/docs/public/favicon.ico +0 -0
- data/docs/public/favicon.svg +1 -0
- data/docs/public/logo-full.svg +1 -0
- data/docs/public/logo.svg +1 -0
- data/docs/public/site.webmanifest +21 -0
- data/docs/public/web-app-manifest-192x192.png +0 -0
- data/docs/public/web-app-manifest-512x512.png +0 -0
- data/fontisan.gemspec +2 -1
- data/lib/fontisan/commands/features_command.rb +0 -1
- data/lib/fontisan/commands/scripts_command.rb +0 -1
- data/lib/fontisan/constants.rb +29 -6
- data/lib/fontisan/font_loader.rb +184 -318
- data/lib/fontisan/loading_modes.rb +0 -2
- data/lib/fontisan/sfnt_font.rb +4 -3
- data/lib/fontisan/tables/glyf/compound_glyph.rb +0 -1
- data/lib/fontisan/variable/delta_applicator.rb +3 -3
- data/lib/fontisan/variation/optimizer.rb +0 -1
- data/lib/fontisan/version.rb +1 -1
- data/lib/fontisan.rb +3 -2
- metadata +136 -4
data/docs/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scripts": {
|
|
3
|
+
"dev": "vitepress dev",
|
|
4
|
+
"build": "vitepress build",
|
|
5
|
+
"preview": "vitepress preview",
|
|
6
|
+
"format": "prettier -w ."
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@types/node": "^25.4.0",
|
|
11
|
+
"prettier": "^3.8.1",
|
|
12
|
+
"typescript": "^5.9.3",
|
|
13
|
+
"vitepress": "^1.6.4"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" id="uuid-c6d7bb0b-ce20-4c4f-b0df-e25e79a561a7" viewBox="0 0 500 500" width="500" height="500"><path d="M64.43,140.29h67.44v13.2h-48.96v180h48.96v13.2h-67.44v-206.4Z" style="fill:#4d4b54;"></path><path d="M352.67,333.5h48.96v-180h-48.96v-13.2h67.44v206.4h-67.44v-13.2Z" style="fill:#4d4b54;"></path><path d="M237.77,169.8c4.32-20.16,8.64-39.6,16.92-54.36,9.36-16.92,24.12-33.48,55.08-33.48,21.96,0,34.2,10.8,34.2,26.28,0,10.44-6.84,15.84-14.4,15.84-9.72,0-13.32-6.48-14.4-14.04-1.44-9-2.16-17.64-10.8-17.64-18.36,0-27.36,21.24-32.76,51.84l-4.32,25.56h34.2l-2.16,14.76h-33.84l-20.52,122.76c-5.04,30.96-21.6,111.6-70.92,111.6-23.04,0-32.04-13.32-32.04-25.92,0-10.08,5.04-17.64,14.4-17.64,21.6,0,9.72,32.04,23.4,32.04,19.08,0,28.44-59.04,32.4-82.8l23.4-140.04h-30.24l1.44-14.76h30.96Z" style="fill:#bf4e6a;"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><svg id="uuid-5b0c2658-028c-4702-accc-5ed4e2e91676" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2100.48 500"><path d="M257.61,451.33c-14.44,6.96-31.78,5.55-41.96-7.84L67.48,248.75c-5.62-7.38-6.35-18.76-.56-25.73l75.41-90.8c3.17-3.82,7.58-5.34,12.06-7.47l160.97-76.62c14.33-6.82,30.68-3.53,42.04,7.07l105.12,142.11c2.69,5.58,5.13,10.27,8.53,15.28l55.82,82.24c5.37,7.91,6.05,23.69-4.06,28.56l-265.21,127.93ZM287.03,310.96l161.6-76.96c11.16-5.32,21.54-22.67,13.21-34.01l-105.49-143.66c-11.5-10.31-27.05-13.14-41.14-6.4l-166.89,79.87c-13.23,6.33-14.59,25.94-6.48,36.81l97.77,131.09c11.25,15.09,29.74,21.66,47.42,13.24ZM232.38,452.15c6.57,2.92,14.18,2.5,21.22-.89l267.88-128.95c8.75-4.21,9.43-18.42,4.56-25.6l-59.66-88.07c-1.3,13.05-7.4,22.31-18.52,27.6l-157.65,75.1c-9.63,4.59-18.53,5.83-29.47,4.16-6.26-3.25-13.52-5.43-18.2-11.67l-100.41-133.93c-6.12-8.16-7.99-15.97-6.35-27.06l-67.77,81.52c-5.01,6.03-4.38,16.57.54,23.04l148.59,195.3c3.88,5.09,9.36,7.96,15.25,9.45Z" style="fill:#676565;"/><path d="M287.03,310.96c-17.68,8.42-36.17,1.85-47.42-13.24l-97.77-131.09c-8.11-10.88-6.75-30.48,6.48-36.81l166.89-79.87c14.09-6.74,29.64-3.91,41.14,6.4l105.49,143.66c8.33,11.34-2.05,28.69-13.21,34.01l-161.6,76.96Z" style="fill:#e1dfd2;"/><path d="M232.38,452.15c1.96-4.82,3.23-9.57,4.66-15.14l27.96-108.44c1.32-5.12-3.24-8.92-4.26-13.08,10.94,1.67,19.84.42,29.47-4.16l157.65-75.1c11.12-5.3,17.22-14.55,18.52-27.6l59.66,88.07c4.87,7.19,4.2,21.39-4.56,25.6l-267.88,128.95c-7.05,3.39-14.65,3.81-21.22.89Z" style="fill:#bebbac;"/><path d="M260.74,315.5c1.02,4.16,5.58,7.95,4.26,13.08l-27.96,108.44c-1.44,5.57-2.71,10.31-4.66,15.14-5.89-1.49-11.37-4.36-15.25-9.45L68.54,247.4c-4.92-6.47-5.55-17.01-.54-23.04l67.77-81.52c-1.64,11.09.23,18.9,6.35,27.06l100.41,133.93c4.68,6.24,11.94,8.42,18.2,11.67Z" style="fill:#dddac8;"/><polygon points="282.54 238.11 289.49 249.09 263.7 260.65 194.99 159.94 222.35 148.43 228.68 158.31 214.22 164.38 269.97 243.75 282.54 238.11" style="fill:#4d4b54;"/><polygon points="369.09 198.8 383.44 192.08 329.33 114.13 315.75 120.26 309.88 111.47 336 98.94 403.17 194.97 375.96 207.94 369.09 198.8" style="fill:#4d4b54;"/><path d="M292.11,160.41c9.03,15.98,17.59,31.55,25.28,48.2,7.43,16.09,16.44,39,4.36,54.53-5.6,7.2-13.93,10.74-22.32,9.15-3.42-.65-5.8-2.78-5.93-5.92-.12-2.78,1.59-5.75,4.93-6.61,2.7-.69,6.2-.29,8.92.64,5.17,1.76,9.75-.71,11.18-6.18,1.14-4.4.26-9.46-1.57-13.97-4.76-11.73-10.73-22.33-17-33.4l-21.8-38.5c-.25-.44-6.36-11.42-6.36-11.42-2.87-6.21-16.16-25.52-5.57-44.8,5.23-9.53,15.89-15.13,26.35-12.59,3.15.76,5.82,3.09,6.27,5.63.57,3.22-1.12,6.43-4.3,7.81-8,3.48-12.19-4.65-17.66-2.08-7.12,3.35-3.91,13.49-1.03,19.02l10.48,20.15c2.29,4.41,1.97,3.58,5.79,10.33Z" style="fill:#bf4e6a;"/><polygon points="266.05 179.81 260.64 171.75 310.91 148.47 315.92 155.96 266.05 179.81" style="fill:#bf4e6a;"/><path d="M703.28,220.77v144.67h-27.95v-144.67h-31.82v-24.08h31.99v-20.92c0-38.32,24.43-61.35,63.11-61.35,15.12,0,24.79,4.22,27.77,5.45l-3.34,22.68c-4.75-2.11-13.54-4.22-23.2-4.22-21.45,0-36.91,10.55-36.91,39.38v18.98h52.38v24.08h-52.03Z" style="fill:#bf4e6a;"/><path d="M863.6,193.17c51.33,0,89.65,38.5,89.65,87.89s-38.32,87.89-89.65,87.89-89.65-38.5-89.65-87.89,38.32-87.89,89.65-87.89ZM863.6,342.94c35.51,0,61.7-27.07,61.7-61.88s-26.19-61.88-61.7-61.88-61.7,27.07-61.7,61.88,26.19,61.88,61.7,61.88Z" style="fill:#bf4e6a;"/><path d="M1154.16,262.78v102.66h-27.77v-95.8c0-32.87-17.23-50.1-47.81-50.1-28.83,0-52.21,19.86-52.21,50.62v95.27h-27.95v-168.75h28.12v25.31c9.49-15.64,29.53-28.83,56.43-28.83,44.47,0,71.19,26.19,71.19,69.61Z" style="fill:#bf4e6a;"/><path d="M1246.27,220.77v91.23c0,22.15,11.95,31.82,29.18,31.82,9.14,0,20.74-1.76,28.83-4.75l3.69,24.08c-7.21,3.16-21.8,5.8-35.51,5.8-32.52,0-54.14-17.93-54.14-52.38v-95.8h-31.11v-24.08h31.29v-54.14h27.6v54.14h53.96v24.08h-53.79Z" style="fill:#bf4e6a;"/><path d="M1339.26,140.09c0-10.2,7.03-17.23,17.23-17.23s17.58,7.03,17.58,17.23-7.38,17.4-17.58,17.4-17.23-7.21-17.23-17.4ZM1342.6,196.69h27.95v168.75h-27.95v-168.75Z" style="fill:#4d4b54;"/><path d="M1496.76,270.34c33.57,6.68,51.33,21.8,51.33,48.16,0,32.87-26.19,50.45-67.15,50.45-23.91,0-47.46-4.75-63.28-12.66l3.87-24.96c15.47,7.91,37.09,12.66,57.48,12.66,27.07,0,41.66-8.44,41.66-24.08s-13.01-21.45-36.74-26.02l-21.97-4.39c-27.95-5.45-45.88-20.21-45.88-46.23,0-30.06,26.54-50.1,68.55-50.1,20.39,0,40.96,3.87,54.14,9.32l-3.52,24.43c-13.71-5.45-32.34-8.96-48.87-8.96-27.42,0-42.54,9.14-42.54,24.61,0,14.59,11.6,19.69,35.33,24.26l17.58,3.52Z" style="fill:#4d4b54;"/><path d="M1757.09,365.44h-27.95v-27.77c-12.66,18.11-34.8,31.29-65.04,31.29-48.34,0-85.08-37.62-85.08-88.42s36.74-87.36,85.08-87.36c30.23,0,52.38,13.01,65.04,31.11v-27.6h27.95v168.75ZM1606.8,280.54c0,34.98,24.96,63.11,60.12,63.11s62.58-28.12,62.58-63.11-26.54-62.05-62.58-62.05-60.12,27.25-60.12,62.05Z" style="fill:#4d4b54;"/><path d="M1971.19,262.78v102.66h-27.77v-95.8c0-32.87-17.23-50.1-47.81-50.1-28.83,0-52.21,19.86-52.21,50.62v95.27h-27.95v-168.75h28.12v25.31c9.49-15.64,29.53-28.83,56.43-28.83,44.47,0,71.19,26.19,71.19,69.61Z" style="fill:#4d4b54;"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><svg id="uuid-bbbd5b2f-b286-4c12-becd-414fca1ebde9" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500"><path d="M210.8,451.33c-14.44,6.96-31.78,5.55-41.96-7.84L20.67,248.75c-5.62-7.38-6.35-18.76-.56-25.73l75.41-90.8c3.17-3.82,7.58-5.34,12.06-7.47l160.97-76.62c14.33-6.82,30.68-3.53,42.04,7.07l105.12,142.11c2.69,5.58,5.13,10.27,8.53,15.28l55.82,82.24c5.37,7.91,6.05,23.69-4.06,28.56l-265.21,127.93ZM240.21,310.96l161.6-76.96c11.16-5.32,21.54-22.67,13.21-34.01l-105.49-143.66c-11.5-10.31-27.05-13.14-41.14-6.4l-166.89,79.87c-13.23,6.33-14.59,25.94-6.48,36.81l97.77,131.09c11.25,15.09,29.74,21.66,47.42,13.24ZM185.57,452.15c6.57,2.92,14.18,2.5,21.22-.89l267.88-128.95c8.75-4.21,9.43-18.42,4.56-25.6l-59.66-88.07c-1.3,13.05-7.4,22.31-18.52,27.6l-157.65,75.1c-9.63,4.59-18.53,5.83-29.47,4.16-6.26-3.25-13.52-5.43-18.2-11.67l-100.41-133.93c-6.12-8.16-7.99-15.97-6.35-27.06L21.19,224.36c-5.01,6.03-4.38,16.57.54,23.04l148.59,195.3c3.88,5.09,9.36,7.96,15.25,9.45Z" style="fill:#676565;"/><path d="M240.21,310.96c-17.68,8.42-36.17,1.85-47.42-13.24l-97.77-131.09c-8.11-10.88-6.75-30.48,6.48-36.81l166.89-79.87c14.09-6.74,29.64-3.91,41.14,6.4l105.49,143.66c8.33,11.34-2.05,28.69-13.21,34.01l-161.6,76.96Z" style="fill:#e1dfd2;"/><path d="M185.57,452.15c1.96-4.82,3.23-9.57,4.66-15.14l27.96-108.44c1.32-5.12-3.24-8.92-4.26-13.08,10.94,1.67,19.84.42,29.47-4.16l157.65-75.1c11.12-5.3,17.22-14.55,18.52-27.6l59.66,88.07c4.87,7.19,4.2,21.39-4.56,25.6l-267.88,128.95c-7.05,3.39-14.65,3.81-21.22.89Z" style="fill:#bebbac;"/><path d="M213.93,315.5c1.02,4.16,5.58,7.95,4.26,13.08l-27.96,108.44c-1.44,5.57-2.71,10.31-4.66,15.14-5.89-1.49-11.37-4.36-15.25-9.45L21.73,247.4c-4.92-6.47-5.55-17.01-.54-23.04l67.77-81.52c-1.64,11.09.23,18.9,6.35,27.06l100.41,133.93c4.68,6.24,11.94,8.42,18.2,11.67Z" style="fill:#dddac8;"/><polygon points="235.73 238.11 242.68 249.09 216.89 260.65 148.18 159.94 175.53 148.43 181.86 158.31 167.41 164.38 223.16 243.75 235.73 238.11" style="fill:#4d4b54;"/><polygon points="322.28 198.8 336.63 192.08 282.52 114.13 268.93 120.26 263.07 111.47 289.19 98.94 356.36 194.97 329.15 207.94 322.28 198.8" style="fill:#4d4b54;"/><path d="M245.3,160.41c9.03,15.98,17.59,31.55,25.28,48.2,7.43,16.09,16.44,39,4.36,54.53-5.6,7.2-13.93,10.74-22.32,9.15-3.42-.65-5.8-2.78-5.93-5.92-.12-2.78,1.59-5.75,4.93-6.61,2.7-.69,6.2-.29,8.92.64,5.17,1.76,9.75-.71,11.18-6.18,1.14-4.4.26-9.46-1.57-13.97-4.76-11.73-10.73-22.33-17-33.4l-21.8-38.5c-.25-.44-6.36-11.42-6.36-11.42-2.87-6.21-16.16-25.52-5.57-44.8,5.23-9.53,15.89-15.13,26.35-12.59,3.15.76,5.82,3.09,6.27,5.63.57,3.22-1.12,6.43-4.3,7.81-8,3.48-12.19-4.65-17.66-2.08-7.12,3.35-3.91,13.49-1.03,19.02l10.48,20.15c2.29,4.41,1.97,3.58,5.79,10.33Z" style="fill:#bf4e6a;"/><polygon points="219.23 179.81 213.82 171.75 264.09 148.47 269.11 155.96 219.23 179.81" style="fill:#bf4e6a;"/></svg>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "MyWebSite",
|
|
3
|
+
"short_name": "MySite",
|
|
4
|
+
"icons": [
|
|
5
|
+
{
|
|
6
|
+
"src": "/web-app-manifest-192x192.png",
|
|
7
|
+
"sizes": "192x192",
|
|
8
|
+
"type": "image/png",
|
|
9
|
+
"purpose": "maskable"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"src": "/web-app-manifest-512x512.png",
|
|
13
|
+
"sizes": "512x512",
|
|
14
|
+
"type": "image/png",
|
|
15
|
+
"purpose": "maskable"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"theme_color": "#ffffff",
|
|
19
|
+
"background_color": "#ffffff",
|
|
20
|
+
"display": "standalone"
|
|
21
|
+
}
|
|
Binary file
|
|
Binary file
|
data/fontisan.gemspec
CHANGED
|
@@ -41,7 +41,8 @@ Gem::Specification.new do |spec|
|
|
|
41
41
|
spec.add_dependency "base64"
|
|
42
42
|
spec.add_dependency "bindata", "~> 2.5"
|
|
43
43
|
spec.add_dependency "brotli", "~> 0.5"
|
|
44
|
-
spec.add_dependency "
|
|
44
|
+
spec.add_dependency "logger"
|
|
45
|
+
spec.add_dependency "lutaml-model", "~> 0.8"
|
|
45
46
|
spec.add_dependency "nokogiri", "~> 1.16"
|
|
46
47
|
spec.add_dependency "thor", "~> 1.3"
|
|
47
48
|
end
|
data/lib/fontisan/constants.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Fontisan
|
|
|
9
9
|
module Constants
|
|
10
10
|
# TrueType Collection file signature tag.
|
|
11
11
|
# All valid TTC files must begin with this 4-byte tag.
|
|
12
|
-
TTC_TAG = "ttcf"
|
|
12
|
+
TTC_TAG = "ttcf".b.freeze
|
|
13
13
|
|
|
14
14
|
# TrueType Collection Version 1.0 identifier.
|
|
15
15
|
# Represents the original TTC format version.
|
|
@@ -25,11 +25,23 @@ module Fontisan
|
|
|
25
25
|
# SFNT version for OpenType fonts with CFF outlines ('OTTO')
|
|
26
26
|
SFNT_VERSION_OTTO = 0x4F54544F
|
|
27
27
|
|
|
28
|
-
# Apple 'true' TrueType signature (alternate to 0x00010000)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
# Apple 'true' TrueType signature (alternate to 0x00010000).
|
|
29
|
+
# Bytes: 0x74 ('t') 0x72 ('r') 0x75 ('u') 0x65 ('e').
|
|
30
|
+
SFNT_VERSION_TRUE = 0x74727565
|
|
31
|
+
|
|
32
|
+
# Four-byte file signatures used for content-based format detection.
|
|
33
|
+
# Pre-packed once here so format detection doesn't repack on every call.
|
|
34
|
+
SFNT_TRUETYPE_MAGIC = "\x00\x01\x00\x00".b.freeze # packed SFNT_VERSION_TRUETYPE
|
|
35
|
+
SFNT_TRUE_MAGIC = "true".b.freeze # Apple legacy TrueType
|
|
36
|
+
SFNT_OTTO_MAGIC = "OTTO".b.freeze # OpenType / CFF
|
|
37
|
+
WOFF_MAGIC = "wOFF".b.freeze
|
|
38
|
+
WOFF2_MAGIC = "wOF2".b.freeze
|
|
39
|
+
|
|
40
|
+
# dfont resource fork signatures.
|
|
41
|
+
# Note: bytes differ from SFNT_TRUETYPE_MAGIC despite the visual similarity —
|
|
42
|
+
# dfont is "\x00\x00\x01\x00" (resource-data offset 256, big-endian),
|
|
43
|
+
# SFNT_TRUETYPE_MAGIC is "\x00\x01\x00\x00" (sfnt version 0x00010000).
|
|
44
|
+
DFONT_RESOURCE_HEADER = "\x00\x00\x01\x00".b.freeze
|
|
33
45
|
SFNT_RESOURCE_TYPE = "sfnt"
|
|
34
46
|
FOND_RESOURCE_TYPE = "FOND"
|
|
35
47
|
|
|
@@ -173,5 +185,16 @@ module Fontisan
|
|
|
173
185
|
def self.intern_string(str)
|
|
174
186
|
STRING_POOL[str] || str.freeze
|
|
175
187
|
end
|
|
188
|
+
|
|
189
|
+
# Classify a 4-byte SFNT-style signature read from a font file's magic.
|
|
190
|
+
#
|
|
191
|
+
# @param signature [String, nil]
|
|
192
|
+
# @return [Symbol, nil] :ttf, :otf, or nil for unrecognised signatures
|
|
193
|
+
def self.sfnt_format_for(signature)
|
|
194
|
+
case signature
|
|
195
|
+
when SFNT_TRUETYPE_MAGIC, SFNT_TRUE_MAGIC then :ttf
|
|
196
|
+
when SFNT_OTTO_MAGIC then :otf
|
|
197
|
+
end
|
|
198
|
+
end
|
|
176
199
|
end
|
|
177
200
|
end
|