Sha256: 0bb3bfa8deb532bbd37f66f1358a3f189525e552afcbd6f64e20d7f4240e0fc8

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module FontProcessor
  class FontFormat
    # Public: The outline format of the file. One of :ttf, :cff
    attr_accessor :outline_format

    # Public: The container format of the file. One of :dyna_base, :otf, :inst, :woff, :woff2, :svg or :swf
    attr_accessor :container_format

    # outline_format - The symbol representing the outline_format.
    # container_format - The symbol representing the container_format.
    def initialize(outline_format, container_format)
      @outline_format = outline_format
      @container_format = container_format
    end

    # Public: Used to generate the fontforge compatible file extension.
    # Unfortunately fontforge uses the file extension to determine what sort of
    # outlines should be contained within a file.
    #
    # They have chosen to represent TrueType files as .ttf and PostScript files
    # as .otf
    #
    # Returns the symbol matching the proper file extension for this format
    #   based on the .outline_format.
    def extension
      { :ttf => :ttf, :cff => :otf }[outline_format]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fontprocessor-27.1.3 lib/fontprocessor/font_format.rb