| 1 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Alex Myczko <[email protected]> |
| 3 |
Date: Jun, 01 2026 10:36:21 +0200 |
| 4 |
Subject: [PATCH] <short summary of the patch> |
| 5 |
|
| 6 |
TODO: Put a short summary on the line above and replace this paragraph |
| 7 |
with a longer explanation of this change. Complete the meta-information |
| 8 |
with other relevant fields (see below for details). To make it easier, the |
| 9 |
information below has been extracted from the changelog. Adjust it or drop |
| 10 |
it. |
| 11 |
|
| 12 |
--- |
| 13 |
The information above should follow the Patch Tagging Guidelines, please |
| 14 |
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here |
| 15 |
are templates for supplementary fields that you might want to add: |
| 16 |
|
| 17 |
Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>) |
| 18 |
Bug: <upstream-bugtracker-url> |
| 19 |
Bug-<Vendor>: <vendor-bugtracker-url> |
| 20 |
Forwarded: (no|not-needed|<patch-forwarded-url>) |
| 21 |
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>) |
| 22 |
Reviewed-By: <name and email of someone who approved/reviewed the patch> |
| 23 |
|
| 24 |
--- fonts-0xproto-2.502+ds.orig/Makefile |
| 25 |
+++ fonts-0xproto-2.502+ds/Makefile |
| 26 |
@@ -8,8 +8,9 @@ SCRIPTS_DIR = scripts |
| 27 |
|
| 28 |
.PHONY: setup |
| 29 |
setup: |
| 30 |
- @echo "Dependencies must be installed via pip (fontmake, fonttools, glyphsLib, ttfautohint-py)" |
| 31 |
- @echo "Run: pip install -r requirements.txt" |
| 32 |
+ @echo "For Debian SID, install: python3-fontmake python3-fonttools" |
| 33 |
+ @echo "Optional dependencies: python3-glyphslib (for Glyphs support)" |
| 34 |
+ @echo "Alternatively, for all dependencies: pip install -r requirements.txt" |
| 35 |
|
| 36 |
.PHONY: build |
| 37 |
build: |
| 38 |
@@ -42,6 +43,4 @@ install: |
| 39 |
|
| 40 |
.PHONY: test |
| 41 |
test: |
| 42 |
- fontbakery check-universal $(OUTPUT_DIR)/$(FONT_NAME)-*.ttf |
| 43 |
- fontbakery check-universal $(OUTPUT_DIR)/No-Ligatures/*.ttf |
| 44 |
- fontbakery check-universal $(OUTPUT_DIR)/ZxProto/*.ttf |
| 45 |
+ python3 $(SCRIPTS_DIR)/validate_fonts.py $(OUTPUT_DIR)/$(FONT_NAME)-*.ttf $(OUTPUT_DIR)/No-Ligatures $(OUTPUT_DIR)/ZxProto |
| 46 |
--- /dev/null |
| 47 |
+++ fonts-0xproto-2.502+ds/scripts/validate_fonts.py |
| 48 |
@@ -0,0 +1,143 @@ |
| 49 |
+#!/usr/bin/env python3 |
| 50 |
+""" |
| 51 |
+Simple font validation script to replace fontbakery check-universal. |
| 52 |
+Validates TTF/OTF fonts without requiring fontbakery installation. |
| 53 |
+""" |
| 54 |
+ |
| 55 |
+import sys |
| 56 |
+import os |
| 57 |
+from fontTools.ttLib import TTFont |
| 58 |
+from pathlib import Path |
| 59 |
+ |
| 60 |
+ |
| 61 |
+def validate_font(font_path): |
| 62 |
+ """ |
| 63 |
+ Validate a single font file. |
| 64 |
+ |
| 65 |
+ Args: |
| 66 |
+ font_path (str): Path to the font file |
| 67 |
+ |
| 68 |
+ Returns: |
| 69 |
+ tuple: (success: bool, message: str) |
| 70 |
+ """ |
| 71 |
+ if not os.path.exists(font_path): |
| 72 |
+ return False, f"File not found: {font_path}" |
| 73 |
+ |
| 74 |
+ if not os.path.isfile(font_path): |
| 75 |
+ return False, f"Not a file: {font_path}" |
| 76 |
+ |
| 77 |
+ try: |
| 78 |
+ font = TTFont(font_path) |
| 79 |
+ |
| 80 |
+ # Check required tables |
| 81 |
+ required_tables = ['head', 'hhea', 'maxp', 'name', 'cmap', 'glyf' if font_path.endswith('.ttf') else 'CFF '] |
| 82 |
+ missing_tables = [t for t in required_tables if t not in font] |
| 83 |
+ |
| 84 |
+ if missing_tables: |
| 85 |
+ return False, f"Missing required tables: {', '.join(missing_tables)}" |
| 86 |
+ |
| 87 |
+ # Check glyph count |
| 88 |
+ num_glyphs = font['maxp'].numGlyphs |
| 89 |
+ if num_glyphs == 0: |
| 90 |
+ return False, "No glyphs in font" |
| 91 |
+ |
| 92 |
+ # Check name table |
| 93 |
+ if 'name' not in font: |
| 94 |
+ return False, "Missing name table" |
| 95 |
+ |
| 96 |
+ # Check cmap table |
| 97 |
+ if 'cmap' not in font or not font['cmap'].tables: |
| 98 |
+ return False, "Missing or empty cmap table" |
| 99 |
+ |
| 100 |
+ # Basic checks passed |
| 101 |
+ file_size = os.path.getsize(font_path) / 1024 |
| 102 |
+ return True, f"✓ Valid font with {num_glyphs} glyphs ({file_size:.1f}KB)" |
| 103 |
+ |
| 104 |
+ except Exception as e: |
| 105 |
+ return False, f"Error reading font: {e}" |
| 106 |
+ |
| 107 |
+ |
| 108 |
+def validate_fonts_in_directory(directory): |
| 109 |
+ """ |
| 110 |
+ Validate all TTF and OTF files in a directory and subdirectories. |
| 111 |
+ |
| 112 |
+ Args: |
| 113 |
+ directory (str): Path to directory to scan |
| 114 |
+ |
| 115 |
+ Returns: |
| 116 |
+ tuple: (success_count: int, failure_count: int, total: int) |
| 117 |
+ """ |
| 118 |
+ font_extensions = ('.ttf', '.otf') |
| 119 |
+ font_files = [] |
| 120 |
+ |
| 121 |
+ # Recursively find all font files |
| 122 |
+ for root, dirs, files in os.walk(directory): |
| 123 |
+ for file in files: |
| 124 |
+ if file.lower().endswith(font_extensions): |
| 125 |
+ font_files.append(os.path.join(root, file)) |
| 126 |
+ |
| 127 |
+ if not font_files: |
| 128 |
+ print(f"No font files found in {directory}") |
| 129 |
+ return 0, 0, 0 |
| 130 |
+ |
| 131 |
+ success_count = 0 |
| 132 |
+ failure_count = 0 |
| 133 |
+ |
| 134 |
+ print(f"Validating {len(font_files)} font file(s)...\n") |
| 135 |
+ |
| 136 |
+ for font_path in sorted(font_files): |
| 137 |
+ rel_path = os.path.relpath(font_path) |
| 138 |
+ success, message = validate_font(font_path) |
| 139 |
+ |
| 140 |
+ if success: |
| 141 |
+ print(f" {rel_path}") |
| 142 |
+ print(f" {message}") |
| 143 |
+ success_count += 1 |
| 144 |
+ else: |
| 145 |
+ print(f" {rel_path}") |
| 146 |
+ print(f" ✗ {message}") |
| 147 |
+ failure_count += 1 |
| 148 |
+ |
| 149 |
+ return success_count, failure_count, len(font_files) |
| 150 |
+ |
| 151 |
+ |
| 152 |
+def main(): |
| 153 |
+ if not sys.argv[1:]: |
| 154 |
+ print("Usage: validate_fonts.py <directory_or_file> [directory_or_file ...]") |
| 155 |
+ print("Validates all TTF/OTF fonts in the given directory/file.") |
| 156 |
+ sys.exit(1) |
| 157 |
+ |
| 158 |
+ total_success = 0 |
| 159 |
+ total_failure = 0 |
| 160 |
+ |
| 161 |
+ for path in sys.argv[1:]: |
| 162 |
+ if os.path.isdir(path): |
| 163 |
+ success, failure, total = validate_fonts_in_directory(path) |
| 164 |
+ total_success += success |
| 165 |
+ total_failure += failure |
| 166 |
+ elif os.path.isfile(path): |
| 167 |
+ success, message = validate_font(path) |
| 168 |
+ if success: |
| 169 |
+ print(f"✓ {path}: {message}") |
| 170 |
+ total_success += 1 |
| 171 |
+ else: |
| 172 |
+ print(f"✗ {path}: {message}") |
| 173 |
+ total_failure += 1 |
| 174 |
+ else: |
| 175 |
+ print(f"Warning: {path} not found") |
| 176 |
+ |
| 177 |
+ # Print summary |
| 178 |
+ print(f"\n{'='*60}") |
| 179 |
+ print(f"Validation Summary:") |
| 180 |
+ print(f" Passed: {total_success}") |
| 181 |
+ print(f" Failed: {total_failure}") |
| 182 |
+ print(f" Total: {total_success + total_failure}") |
| 183 |
+ print(f"{'='*60}") |
| 184 |
+ |
| 185 |
+ if total_failure > 0: |
| 186 |
+ sys.exit(1) |
| 187 |
+ sys.exit(0) |
| 188 |
+ |
| 189 |
+ |
| 190 |
+if __name__ == "__main__": |
| 191 |
+ main() |