fontist 2.1.4 → 2.1.6
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/.gitignore +1 -0
- data/.rubocop_todo.yml +411 -10
- data/Gemfile +1 -0
- data/docs/.vitepress/config.ts +17 -0
- data/docs/cli/create-formula.md +6 -0
- data/docs/cli/import.md +4 -0
- data/docs/guide/formulas.md +73 -0
- data/docs/guide/installation.md +62 -0
- data/docs/guide/maintainer/import.md +372 -0
- data/docs/guide/maintainer/index.md +37 -0
- data/docs/guide/platforms/index.md +72 -0
- data/docs/guide/platforms/macos.md +151 -0
- data/docs/guide/platforms/windows.md +220 -0
- data/fontist.gemspec +0 -1
- data/lib/fontist/cache/manager.rb +0 -2
- data/lib/fontist/cache.rb +6 -0
- data/lib/fontist/cli/thor_ext.rb +0 -2
- data/lib/fontist/cli.rb +0 -9
- data/lib/fontist/collection_file.rb +0 -3
- data/lib/fontist/font.rb +0 -6
- data/lib/fontist/font_collection.rb +0 -1
- data/lib/fontist/font_file.rb +0 -1
- data/lib/fontist/font_installer.rb +0 -5
- data/lib/fontist/font_model.rb +0 -1
- data/lib/fontist/font_path.rb +0 -2
- data/lib/fontist/formula.rb +0 -13
- data/lib/fontist/formula_picker.rb +0 -2
- data/lib/fontist/google_import_source.rb +0 -2
- data/lib/fontist/import/convert_formulas.rb +0 -2
- data/lib/fontist/import/create_formula.rb +0 -4
- data/lib/fontist/import/files/collection_file.rb +0 -1
- data/lib/fontist/import/files.rb +8 -0
- data/lib/fontist/import/font_metadata_extractor.rb +0 -1
- data/lib/fontist/import/formula_builder.rb +0 -6
- data/lib/fontist/import/google/api.rb +0 -9
- data/lib/fontist/import/google/data_sources/base.rb +0 -1
- data/lib/fontist/import/google/data_sources/github.rb +0 -3
- data/lib/fontist/import/google/data_sources/ttf.rb +0 -2
- data/lib/fontist/import/google/data_sources/vf.rb +0 -2
- data/lib/fontist/import/google/data_sources/woff2.rb +0 -2
- data/lib/fontist/import/google/data_sources.rb +13 -0
- data/lib/fontist/import/google/font_database.rb +0 -10
- data/lib/fontist/import/google/metadata_adapter.rb +0 -1
- data/lib/fontist/import/google/models/font_family.rb +0 -1
- data/lib/fontist/import/google/models/metadata.rb +1 -9
- data/lib/fontist/import/google/models/source_metadata.rb +0 -1
- data/lib/fontist/import/google/models.rb +16 -0
- data/lib/fontist/import/google.rb +7 -2
- data/lib/fontist/import/google_fonts_importer.rb +0 -5
- data/lib/fontist/import/google_import.rb +1 -8
- data/lib/fontist/import/helpers.rb +8 -0
- data/lib/fontist/import/macos.rb +0 -6
- data/lib/fontist/import/manual_formula_builder.rb +0 -2
- data/lib/fontist/import/models.rb +7 -0
- data/lib/fontist/import/otf/font_file.rb +0 -2
- data/lib/fontist/import/otf.rb +7 -0
- data/lib/fontist/import/recursive_extraction.rb +0 -5
- data/lib/fontist/import/sil_import.rb +0 -3
- data/lib/fontist/import/upgrade_formulas.rb +1 -11
- data/lib/fontist/import.rb +23 -0
- data/lib/fontist/import_cli.rb +0 -9
- data/lib/fontist/index.rb +0 -4
- data/lib/fontist/index_cli.rb +0 -2
- data/lib/fontist/indexes/base_font_collection_index.rb +0 -1
- data/lib/fontist/indexes/default_family_font_index.rb +0 -2
- data/lib/fontist/indexes/directory_snapshot.rb +0 -2
- data/lib/fontist/indexes/filename_index.rb +0 -2
- data/lib/fontist/indexes/font_index.rb +0 -3
- data/lib/fontist/indexes/fontist_index.rb +0 -2
- data/lib/fontist/indexes/incremental_index_updater.rb +0 -4
- data/lib/fontist/indexes/preferred_family_font_index.rb +0 -2
- data/lib/fontist/indexes/system_index.rb +0 -2
- data/lib/fontist/indexes/user_index.rb +0 -2
- data/lib/fontist/indexes.rb +18 -0
- data/lib/fontist/install_location.rb +0 -4
- data/lib/fontist/install_locations/fontist_location.rb +0 -2
- data/lib/fontist/install_locations/system_location.rb +0 -2
- data/lib/fontist/install_locations/user_location.rb +0 -2
- data/lib/fontist/install_locations.rb +8 -0
- data/lib/fontist/macos/catalog/asset.rb +0 -2
- data/lib/fontist/macos/catalog/base_parser.rb +0 -1
- data/lib/fontist/macos/catalog/catalog_manager.rb +0 -6
- data/lib/fontist/macos/catalog/font3_parser.rb +0 -2
- data/lib/fontist/macos/catalog/font4_parser.rb +0 -2
- data/lib/fontist/macos/catalog/font5_parser.rb +0 -2
- data/lib/fontist/macos/catalog/font6_parser.rb +0 -2
- data/lib/fontist/macos/catalog/font7_parser.rb +0 -2
- data/lib/fontist/macos/catalog/font8_parser.rb +0 -2
- data/lib/fontist/macos/catalog.rb +15 -0
- data/lib/fontist/macos.rb +5 -0
- data/lib/fontist/macos_import_source.rb +0 -2
- data/lib/fontist/manifest_request.rb +0 -1
- data/lib/fontist/manifest_response.rb +0 -1
- data/lib/fontist/resources.rb +7 -0
- data/lib/fontist/sil_import_source.rb +0 -2
- data/lib/fontist/system_font.rb +0 -2
- data/lib/fontist/system_index.rb +0 -4
- data/lib/fontist/utils/cache.rb +0 -2
- data/lib/fontist/utils/downloader.rb +0 -4
- data/lib/fontist/utils.rb +10 -8
- data/lib/fontist/validate_cli.rb +0 -4
- data/lib/fontist/validator.rb +0 -2
- data/lib/fontist/version.rb +1 -1
- data/lib/fontist.rb +83 -36
- metadata +19 -16
data/lib/fontist/import/macos.rb
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
require "plist"
|
|
2
2
|
require "nokogiri"
|
|
3
3
|
require "paint"
|
|
4
|
-
require_relative "create_formula"
|
|
5
|
-
require_relative "recursive_extraction"
|
|
6
|
-
require_relative "../macos/catalog/catalog_manager"
|
|
7
|
-
require_relative "../macos_import_source"
|
|
8
|
-
require_relative "../google_import_source"
|
|
9
|
-
require_relative "../sil_import_source"
|
|
10
4
|
|
|
11
5
|
module Fontist
|
|
12
6
|
module Import
|
|
@@ -2,7 +2,7 @@ require "fileutils"
|
|
|
2
2
|
require "yaml"
|
|
3
3
|
require "tmpdir"
|
|
4
4
|
require "find"
|
|
5
|
-
|
|
5
|
+
require "rubygems/package"
|
|
6
6
|
|
|
7
7
|
module Fontist
|
|
8
8
|
module Import
|
|
@@ -251,9 +251,6 @@ module Fontist
|
|
|
251
251
|
# @param url [String] the URL to download
|
|
252
252
|
# @return [String, nil] path to downloaded file or nil
|
|
253
253
|
def download_resource(url)
|
|
254
|
-
# Lazy load downloader to avoid dependency issues
|
|
255
|
-
require_relative "../utils/downloader" unless defined?(Fontist::Utils::Downloader)
|
|
256
|
-
|
|
257
254
|
Fontist::Utils::Downloader.download(url)
|
|
258
255
|
rescue StandardError => e
|
|
259
256
|
log " Warning: Download failed for #{url}: #{e.message}"
|
|
@@ -299,9 +296,6 @@ module Fontist
|
|
|
299
296
|
|
|
300
297
|
# Try to parse with Otf::FontFile
|
|
301
298
|
begin
|
|
302
|
-
# Lazy load Otf::FontFile to avoid dependency issues
|
|
303
|
-
require_relative "otf/font_file" unless defined?(Fontist::Import::Otf::FontFile)
|
|
304
|
-
|
|
305
299
|
Otf::FontFile.new(path)
|
|
306
300
|
# If it parses, it's likely a font file
|
|
307
301
|
# Guess ttf if we can't determine
|
|
@@ -392,7 +386,6 @@ module Fontist
|
|
|
392
386
|
# @param extract_dir [String] directory to extract to
|
|
393
387
|
# @return [void]
|
|
394
388
|
def extract_tar_gz(archive_path, extract_dir)
|
|
395
|
-
require "rubygems/package"
|
|
396
389
|
require "zlib"
|
|
397
390
|
|
|
398
391
|
File.open(archive_path, "rb") do |file|
|
|
@@ -410,7 +403,6 @@ module Fontist
|
|
|
410
403
|
# @param extract_dir [String] directory to extract to
|
|
411
404
|
# @return [void]
|
|
412
405
|
def extract_tar_bz2(archive_path, extract_dir)
|
|
413
|
-
require "rubygems/package"
|
|
414
406
|
require "bzip2/ffi"
|
|
415
407
|
|
|
416
408
|
File.open(archive_path, "rb") do |file|
|
|
@@ -428,8 +420,6 @@ module Fontist
|
|
|
428
420
|
# @param extract_dir [String] directory to extract to
|
|
429
421
|
# @return [void]
|
|
430
422
|
def extract_tar(archive_path, extract_dir)
|
|
431
|
-
require "rubygems/package"
|
|
432
|
-
|
|
433
423
|
File.open(archive_path, "rb") do |file|
|
|
434
424
|
Gem::Package::TarReader.new(file) do |tar|
|
|
435
425
|
extract_tar_entries(tar, extract_dir)
|
data/lib/fontist/import.rb
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
module Fontist
|
|
2
2
|
module Import
|
|
3
|
+
autoload :ConvertFormulas, "#{__dir__}/import/convert_formulas"
|
|
4
|
+
autoload :CreateFormula, "#{__dir__}/import/create_formula"
|
|
5
|
+
autoload :Files, "#{__dir__}/import/files"
|
|
6
|
+
autoload :FontMetadataExtractor, "#{__dir__}/import/font_metadata_extractor"
|
|
7
|
+
autoload :FontParsingErrorCollector, "#{__dir__}/import/font_parsing_error_collector"
|
|
8
|
+
autoload :FontStyle, "#{__dir__}/import/font_style"
|
|
9
|
+
autoload :FormulaBuilder, "#{__dir__}/import/formula_builder"
|
|
10
|
+
autoload :FormulaSerializer, "#{__dir__}/import/formula_serializer"
|
|
11
|
+
autoload :Google, "#{__dir__}/import/google"
|
|
12
|
+
autoload :GoogleFontsImporter, "#{__dir__}/import/google_fonts_importer"
|
|
13
|
+
autoload :GoogleImport, "#{__dir__}/import/google_import"
|
|
14
|
+
autoload :Helpers, "#{__dir__}/import/helpers"
|
|
15
|
+
autoload :ImportDisplay, "#{__dir__}/import/import_display"
|
|
16
|
+
autoload :Macos, "#{__dir__}/import/macos"
|
|
17
|
+
autoload :ManualFormulaBuilder, "#{__dir__}/import/manual_formula_builder"
|
|
18
|
+
autoload :Models, "#{__dir__}/import/models"
|
|
19
|
+
autoload :Otf, "#{__dir__}/import/otf"
|
|
20
|
+
autoload :RecursiveExtraction, "#{__dir__}/import/recursive_extraction"
|
|
21
|
+
autoload :SilImport, "#{__dir__}/import/sil_import"
|
|
22
|
+
autoload :TemplateHelper, "#{__dir__}/import/template_helper"
|
|
23
|
+
autoload :TextHelper, "#{__dir__}/import/text_helper"
|
|
24
|
+
autoload :UpgradeFormulas, "#{__dir__}/import/upgrade_formulas"
|
|
25
|
+
|
|
3
26
|
class << self
|
|
4
27
|
def name_to_filename(name)
|
|
5
28
|
"#{name.downcase.gsub(' ', '_')}.yml"
|
data/lib/fontist/import_cli.rb
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
require_relative "import/google"
|
|
2
|
-
|
|
3
1
|
module Fontist
|
|
4
2
|
class ImportCLI < Thor
|
|
5
3
|
include CLI::ClassOptions
|
|
@@ -27,8 +25,6 @@ module Fontist
|
|
|
27
25
|
def google
|
|
28
26
|
handle_class_options(options)
|
|
29
27
|
|
|
30
|
-
require "fontist/import/google_fonts_importer"
|
|
31
|
-
|
|
32
28
|
# Support both --font-name and --font-family (backward compatibility)
|
|
33
29
|
font_name = options[:font_name] || options[:font_family]
|
|
34
30
|
|
|
@@ -85,7 +81,6 @@ module Fontist
|
|
|
85
81
|
|
|
86
82
|
def macos
|
|
87
83
|
handle_class_options(options)
|
|
88
|
-
require_relative "import/macos"
|
|
89
84
|
|
|
90
85
|
# Handle deprecated formulas_dir option
|
|
91
86
|
output_dir = if options[:formulas_dir] && !options[:output_path]
|
|
@@ -136,8 +131,6 @@ module Fontist
|
|
|
136
131
|
def sil
|
|
137
132
|
handle_class_options(options)
|
|
138
133
|
|
|
139
|
-
require "fontist/import/sil_import"
|
|
140
|
-
|
|
141
134
|
importer = Fontist::Import::SilImport.new(
|
|
142
135
|
output_path: options[:output_path],
|
|
143
136
|
font_name: options[:font_name],
|
|
@@ -180,8 +173,6 @@ module Fontist
|
|
|
180
173
|
end
|
|
181
174
|
|
|
182
175
|
def detect_latest_catalog
|
|
183
|
-
require_relative "macos/catalog/catalog_manager"
|
|
184
|
-
|
|
185
176
|
catalogs = Fontist::Macos::Catalog::CatalogManager.available_catalogs
|
|
186
177
|
|
|
187
178
|
if catalogs.empty?
|
data/lib/fontist/index.rb
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
require "lutaml/model"
|
|
2
|
-
require_relative "indexes/filename_index"
|
|
3
|
-
require_relative "indexes/font_index"
|
|
4
|
-
require_relative "indexes/default_family_font_index"
|
|
5
|
-
require_relative "indexes/preferred_family_font_index"
|
|
6
2
|
|
|
7
3
|
module Fontist
|
|
8
4
|
class IndexEntry < Lutaml::Model::Serializable
|
data/lib/fontist/index_cli.rb
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Fontist
|
|
2
|
+
module Indexes
|
|
3
|
+
autoload :BaseFontCollectionIndex, "#{__dir__}/indexes/base_font_collection_index"
|
|
4
|
+
autoload :DefaultFamilyFontIndex, "#{__dir__}/indexes/default_family_font_index"
|
|
5
|
+
autoload :DirectoryChange, "#{__dir__}/indexes/directory_change"
|
|
6
|
+
autoload :DirectorySnapshot, "#{__dir__}/indexes/directory_snapshot"
|
|
7
|
+
autoload :FilenameIndex, "#{__dir__}/indexes/filename_index"
|
|
8
|
+
autoload :FontIndex, "#{__dir__}/indexes/font_index"
|
|
9
|
+
autoload :FontistIndex, "#{__dir__}/indexes/fontist_index"
|
|
10
|
+
autoload :FormulaKeyToPath, "#{__dir__}/indexes/formula_key_to_path"
|
|
11
|
+
autoload :IncrementalIndexUpdater, "#{__dir__}/indexes/incremental_index_updater"
|
|
12
|
+
autoload :IncrementalScanner, "#{__dir__}/indexes/incremental_scanner"
|
|
13
|
+
autoload :IndexMixin, "#{__dir__}/indexes/index_mixin"
|
|
14
|
+
autoload :PreferredFamilyFontIndex, "#{__dir__}/indexes/preferred_family_font_index"
|
|
15
|
+
autoload :SystemIndex, "#{__dir__}/indexes/system_index"
|
|
16
|
+
autoload :UserIndex, "#{__dir__}/indexes/user_index"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
require "pathname"
|
|
2
|
-
require_relative "install_locations/base_location"
|
|
3
|
-
require_relative "install_locations/fontist_location"
|
|
4
|
-
require_relative "install_locations/user_location"
|
|
5
|
-
require_relative "install_locations/system_location"
|
|
6
2
|
|
|
7
3
|
module Fontist
|
|
8
4
|
# Factory for creating font installation location objects
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
module Fontist
|
|
2
|
+
module InstallLocations
|
|
3
|
+
autoload :BaseLocation, "#{__dir__}/install_locations/base_location"
|
|
4
|
+
autoload :FontistLocation, "#{__dir__}/install_locations/fontist_location"
|
|
5
|
+
autoload :SystemLocation, "#{__dir__}/install_locations/system_location"
|
|
6
|
+
autoload :UserLocation, "#{__dir__}/install_locations/user_location"
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Fontist
|
|
2
|
+
module Macos
|
|
3
|
+
module Catalog
|
|
4
|
+
autoload :Asset, "#{__dir__}/catalog/asset"
|
|
5
|
+
autoload :BaseParser, "#{__dir__}/catalog/base_parser"
|
|
6
|
+
autoload :CatalogManager, "#{__dir__}/catalog/catalog_manager"
|
|
7
|
+
autoload :Font3Parser, "#{__dir__}/catalog/font3_parser"
|
|
8
|
+
autoload :Font4Parser, "#{__dir__}/catalog/font4_parser"
|
|
9
|
+
autoload :Font5Parser, "#{__dir__}/catalog/font5_parser"
|
|
10
|
+
autoload :Font6Parser, "#{__dir__}/catalog/font6_parser"
|
|
11
|
+
autoload :Font7Parser, "#{__dir__}/catalog/font7_parser"
|
|
12
|
+
autoload :Font8Parser, "#{__dir__}/catalog/font8_parser"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/fontist/system_font.rb
CHANGED
data/lib/fontist/system_index.rb
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
require_relative "font_file"
|
|
2
|
-
require_relative "collection_file"
|
|
3
1
|
require "paint"
|
|
4
2
|
|
|
5
3
|
module Fontist
|
|
@@ -433,8 +431,6 @@ module Fontist
|
|
|
433
431
|
def extract_font_directories
|
|
434
432
|
# Extract base directories from the paths that will be globbed
|
|
435
433
|
# This uses the actual system configuration it will scan
|
|
436
|
-
require_relative "system_font"
|
|
437
|
-
|
|
438
434
|
os = Fontist::Utils::System.user_os.to_s
|
|
439
435
|
templates = SystemFont.system_config["system"][os]["paths"]
|
|
440
436
|
|
data/lib/fontist/utils/cache.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require "lutaml/model"
|
|
2
2
|
require "marcel"
|
|
3
|
-
require_relative "locking"
|
|
4
3
|
|
|
5
4
|
module Fontist
|
|
6
5
|
module Utils
|
|
@@ -189,7 +188,6 @@ module Fontist
|
|
|
189
188
|
|
|
190
189
|
def response_to_filename(source)
|
|
191
190
|
if File.extname(source.original_filename).empty? && source.content_type
|
|
192
|
-
require "marcel"
|
|
193
191
|
ext = extension_from_mime(source.content_type)
|
|
194
192
|
return "#{source.original_filename}.#{ext}" if ext
|
|
195
193
|
end
|
data/lib/fontist/utils.rb
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
require_relative "utils/system"
|
|
2
|
-
require_relative "utils/file_magic"
|
|
3
|
-
require_relative "utils/locking"
|
|
4
|
-
require_relative "utils/downloader"
|
|
5
|
-
require_relative "utils/cache"
|
|
6
|
-
require_relative "utils/ui"
|
|
7
|
-
require_relative "utils/file_ops"
|
|
8
|
-
|
|
9
1
|
module Fontist
|
|
10
2
|
module Utils
|
|
3
|
+
autoload :Cache, "#{__dir__}/utils/cache"
|
|
4
|
+
autoload :Downloader, "#{__dir__}/utils/downloader"
|
|
5
|
+
autoload :FileMagic, "#{__dir__}/utils/file_magic"
|
|
6
|
+
autoload :FileOps, "#{__dir__}/utils/file_ops"
|
|
7
|
+
autoload :GitHubClient, "#{__dir__}/utils/github_client"
|
|
8
|
+
autoload :GitHubUrl, "#{__dir__}/utils/github_url"
|
|
9
|
+
autoload :Locking, "#{__dir__}/utils/locking"
|
|
10
|
+
autoload :System, "#{__dir__}/utils/system"
|
|
11
|
+
autoload :UI, "#{__dir__}/utils/ui"
|
|
12
|
+
|
|
11
13
|
# Converts a glob pattern to case-insensitive by replacing each
|
|
12
14
|
# alphabetic character with a character class [aA]
|
|
13
15
|
#
|
data/lib/fontist/validate_cli.rb
CHANGED
data/lib/fontist/validator.rb
CHANGED
data/lib/fontist/version.rb
CHANGED