Class: Fontisan::Commands::OpticalSizeCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Fontisan::Commands::OpticalSizeCommand
- Defined in:
- lib/fontisan/commands/optical_size_command.rb
Overview
Command to extract optical size information from fonts
Optical size information indicates the design size range for which a font is optimized. This information can come from:
- OS/2 table version 5+ (usLowerOpticalPointSize, usUpperOpticalPointSize)
- GPOS 'size' feature (not yet implemented)
Instance Method Summary collapse
-
#run ⇒ Models::OpticalSizeInfo
Execute the optical size extraction command.
Methods inherited from BaseCommand
Constructor Details
This class inherits a constructor from Fontisan::Commands::BaseCommand
Instance Method Details
#run ⇒ Models::OpticalSizeInfo
Execute the optical size extraction command
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fontisan/commands/optical_size_command.rb', line 15 def run result = Models::OpticalSizeInfo.new # Try OS/2 table first if font.has_table?(Constants::OS2_TAG) os2_table = font.table(Constants::OS2_TAG) if os2_table.has_optical_point_size? result.has_optical_size = true result.source = "os2" result.lower_point_size = os2_table.lower_optical_point_size result.upper_point_size = os2_table.upper_optical_point_size return result end end # No optical size information result.has_optical_size = false result.source = "none" result end |