Sha256: b98f794ac57411229971f4387e27a92a028fa35e119de680fd0b857edd033af7

Contents?: true

Size: 826 Bytes

Versions: 2

Compression:

Stored size: 826 Bytes

Contents

module OpenXml
  module Pptx
    module Properties
      class Font < OpenXml::Properties::ComplexProperty
        namespace :p
        tag :font

        # TODO: Add charset, panose, and pitchFamily attributes
        attribute :typeface, expects: :string, required: true

        def initialize(value)
          super()
          raise ArgumentError, invalid_message unless value.is_a?(String)
          self.typeface = value
        end

        def invalid_message
          "Invalid font: value must be a string indicating the typeface"
        end

      private

        # Overridden since typeface _can_ be a zero-length string
        def string(value)
          message = "Invalid typeface: must be a string"
          raise ArgumentError, message unless value.is_a?(String)
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openxml-pptx-0.2.2 lib/openxml/pptx/properties/font.rb
openxml-pptx-0.2.0 lib/openxml/pptx/properties/font.rb