Class: Fontisan::Audit::Checks::GlyphNameCheck

Inherits:
Fontisan::Audit::Check show all
Defined in:
lib/fontisan/audit/checks/glyph_name_check.rb

Overview

Validates glyph names against the OpenType spec rules:

- Length ≤ 63 characters
- Allowed characters: printable ASCII excluding special chars
(per OT spec: A–Z a–z 0–9, period, hyphen, underscore)
- Must not start with a digit
- Must not be a reserved name (.notdef is the only exception at GID 0)
- Duplicate names across the font (warning)
- Empty names (warning — some tools tolerate them but spec discourages)

Constant Summary collapse

MAX_NAME_LENGTH =
63
ALLOWED_NAME_PATTERN =

OT spec post table glyph name charset: A–Z a–z 0–9 . - _ (leading dot is allowed for .notdef, .null, .nonmarkingreturn, etc.)

/\A[A-Za-z0-9._-]+\z/

Class Method Summary collapse

Methods inherited from Fontisan::Audit::Check

issue

Class Method Details

.call(font) ⇒ Array<Models::ValidationReport::Issue>

Parameters:

Returns:



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fontisan/audit/checks/glyph_name_check.rb', line 25

def self.call(font)
  names = extract_glyph_names(font)
  return [] if names.empty?

  issues = []
  names.each_with_index do |name, gid|
    issues.concat(check_name(name, gid))
  end
  issues.concat(check_duplicates(names))
  issues
end

.codeObject



37
38
39
# File 'lib/fontisan/audit/checks/glyph_name_check.rb', line 37

def self.code
  :glyph_names
end