fontisan 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fe760da43bddcfad046aef63c311613ea3767569245b21a2bda6a6d5f100a5f
4
- data.tar.gz: 7571202d9bc900928ee4c3859e4081af6d561f53740587f0f94f7a159dbbbec3
3
+ metadata.gz: '0979321b74749068da214fbb4880701c1f78905cce2db2aa7a8a2263da669af3'
4
+ data.tar.gz: 3ccbb49464b62e831475fe601fecc9b7085c6dda5a16ec66d9b9c56c14ff0742
5
5
  SHA512:
6
- metadata.gz: 66e94f6047f20385c27583a191d5c78ded6589ee8d2004386613062adb2071aba41644736c632be4087e24998ae29a7066fc17e42773a3627832c32f67d3c670
7
- data.tar.gz: b9180051a16410731a112602c4ff5d18b679b6c6e521d31f092b5be2c550aceaae8992729c6bc71d7dd919b71b669217866febd26ce014528cd91eb392af1c96
6
+ metadata.gz: 87538383c69009f3610778a717ae6263accb950e07b8803914358927bfc1e7510c18c664d88267b17dcabbeaab4fa97d4ac72b3294ae492472d0659843dbe540
7
+ data.tar.gz: 459343281dd3b295141eed4c8091ccc3d9ce6228d49c293eb6a182d26676428eaf4cb571295b8f55ac4101ba88d879c7525b06f5ad1596a83ea544d2f88a8351
data/README.adoc CHANGED
@@ -2376,6 +2376,106 @@ Fontisan can:
2376
2376
  * Importing and generation PNG block ruler layers
2377
2377
 
2378
2378
 
2379
+ == UFO source operations
2380
+
2381
+ fontisan reads, writes, and compiles UFO (Unified Font Object) v2/v3
2382
+ font sources into binary font formats (TTF, OTF). No AFDKO or Python
2383
+ fonttools needed.
2384
+
2385
+ === Build a UFO to binary
2386
+
2387
+ [source,bash]
2388
+ ----
2389
+ # TTF (TrueType outlines)
2390
+ fontisan ufo build font.ufo --output out.ttf --to ttf
2391
+
2392
+ # OTF (CFF outlines)
2393
+ fontisan ufo build font.ufo --output out.otf --to otf
2394
+ ----
2395
+
2396
+ The TTF compiler automatically applies:
2397
+ - `cubic_to_quadratic` filter (UFO cubic Beziers -> TTF quadratic)
2398
+ - `reverse_contour_direction` filter (TTF winding convention)
2399
+
2400
+ === Convert between UFO and binary
2401
+
2402
+ [source,bash]
2403
+ ----
2404
+ # UFO -> binary
2405
+ fontisan ufo convert font.ufo out.ttf --to ttf
2406
+
2407
+ # Binary -> UFO (reverse direction)
2408
+ fontisan ufo convert font.ttf font.ufo/
2409
+ ----
2410
+
2411
+ === Validate a UFO source
2412
+
2413
+ [source,bash]
2414
+ ----
2415
+ fontisan ufo validate font.ufo
2416
+ ----
2417
+
2418
+ Checks: glyphs present, family name set, unitsPerEm set, .notdef exists.
2419
+
2420
+ === Ruby API
2421
+
2422
+ [source,ruby]
2423
+ ----
2424
+ require "fontisan"
2425
+
2426
+ # Read a UFO
2427
+ font = Fontisan::Ufo::Font.open("font.ufo")
2428
+ puts font.family_name
2429
+ puts font.glyphs.size
2430
+
2431
+ # Compile to TTF
2432
+ Fontisan::Ufo::Compile::TtfCompiler.new(font).compile(output_path: "out.ttf")
2433
+
2434
+ # Compile to OTF
2435
+ Fontisan::Ufo::Compile::OtfCompiler.new(font).compile(output_path: "out.otf")
2436
+
2437
+ # Write back to UFO (round-trip)
2438
+ Fontisan::Ufo::Writer.new(font).write("out.ufo")
2439
+
2440
+ # Convert a binary font to UFO
2441
+ ttf = Fontisan::FontLoader.load("font.ttf")
2442
+ ufo = Fontisan::Ufo::Convert::FromBinData.convert(ttf)
2443
+ ----
2444
+
2445
+ == Font stitching
2446
+
2447
+ The Stitcher combines glyphs from multiple source fonts into one new
2448
+ font. Sources can be UFO directories or loaded TTF/OTF files.
2449
+
2450
+ === Ruby API
2451
+
2452
+ [source,ruby]
2453
+ ----
2454
+ stitcher = Fontisan::Stitcher.new
2455
+ stitcher.add_source(:latin, Fontisan::FontLoader.load("NotoSans.ttf"))
2456
+ stitcher.add_source(:cjk, Fontisan::FontLoader.load("FSung-m.ttf"))
2457
+
2458
+ stitcher.include_range(0x41..0x5A, from: :latin) # A-Z
2459
+ stitcher.include_range(0x4E00..0x9FFF, from: :cjk) # CJK Unified
2460
+ stitcher.include_notdef(from: :latin)
2461
+
2462
+ stitcher.write_to("stitched.ttf", format: :ttf)
2463
+ ----
2464
+
2465
+ === CLI
2466
+
2467
+ [source,bash]
2468
+ ----
2469
+ fontisan stitch \
2470
+ --source latin=NotoSans.ttf \
2471
+ --source cjk=FSung-m.ttf \
2472
+ --include-range latin=0x41-0x5A \
2473
+ --include-range cjk=0x4E00-0x9FFF \
2474
+ --notdef-from latin \
2475
+ --output stitched.ttf
2476
+ ----
2477
+
2478
+
2379
2479
  == Testing
2380
2480
 
2381
2481
  === General
@@ -53,7 +53,8 @@ module Fontisan
53
53
  end
54
54
 
55
55
  def self.empty_charstring(width)
56
- Fontisan::Tables::Cff::CharStringBuilder.build_empty(width: width.zero? ? nil : width)
56
+ builder = Fontisan::Tables::Cff::CharStringBuilder.new
57
+ builder.build_empty(width: width.zero? ? nil : width)
57
58
  end
58
59
 
59
60
  # ---------- layout ----------
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fontisan
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontisan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-29 00:00:00.000000000 Z
11
+ date: 2026-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64