Class: Fontist::Indexes::UserIndex

Inherits:
BaseFontCollectionIndex show all
Defined in:
lib/fontist/indexes/user_index.rb

Overview

Index for fonts installed in the user font directory

This index tracks all fonts installed in the user-specific font location (platform-dependent, typically with /fontist subdirectory) using a singleton pattern to ensure consistent state across the application.

## Responsibilities

  • Maintain index of all user location fonts

  • Provide fast font lookups by name and style

  • Auto-rebuild when font directories change

  • Cache results for performance

## Index File

Located at: ~/.fontist/user_index.default_family.yml

## Platform-Specific Paths Indexed

  • macOS: ~/Library/Fonts/fontist/*/.ttf,otf,ttc,otc

  • Linux: ~/.local/share/fonts/fontist/*/.ttf,otf,ttc,otc

  • Windows: %LOCALAPPDATA%/Microsoft/Windows/Fonts/fontist/*/.ttf,otf,ttc,otc

## Usage

index = Fontist::Indexes::UserIndex.instance
fonts = index.find("Arial", "Bold")
index.add_font("/path/to/font.ttf")
index.rebuild(verbose: true)

Method Summary

Methods inherited from BaseFontCollectionIndex

#add_font, #collection, #find, #font_exists?, #fonts, #initialize, #read_only_mode, #rebuild, #remove_font, reset_cache, #reset_cache

Constructor Details

This class inherits a constructor from Fontist::Indexes::BaseFontCollectionIndex