class BerkeleyLibrary::Util::ODS::XML::Style::FontFace
Constants
- DEFAULT_FONT_FACE
Attributes
family_generic[R]
font_pitch[R]
name[R]
svg_family[R]
Public Class Methods
default_face(doc:)
click to toggle source
# File lib/berkeley_library/util/ods/xml/style/font_face.rb, line 23 def default_face(doc:) FontFace.new(FontFace::DEFAULT_FONT_FACE, family_generic: 'swiss', font_pitch: 'variable', doc: doc) end
new(name, doc:, svg_family: nil, family_generic: nil, font_pitch: nil)
click to toggle source
Calls superclass method
BerkeleyLibrary::Util::ODS::XML::ElementNode::new
# File lib/berkeley_library/util/ods/xml/style/font_face.rb, line 13 def initialize(name, doc:, svg_family: nil, family_generic: nil, font_pitch: nil) super(:style, 'font-face', doc: doc) set_attribute('name', name) set_attribute(:svg, 'font-family', svg_family || to_family(name)) set_attribute('font-family-generic', family_generic) if family_generic set_attribute('font-pitch', font_pitch) if font_pitch end
Private Instance Methods
quote_name(name)
click to toggle source
# File lib/berkeley_library/util/ods/xml/style/font_face.rb, line 35 def quote_name(name) return name.inspect if name.include?("'") "'#{name}'" end
to_family(name)
click to toggle source
# File lib/berkeley_library/util/ods/xml/style/font_face.rb, line 30 def to_family(name) # TODO: https://www.w3.org/TR/CSS2/syndata.html#value-def-identifier name =~ /^[[:alpha:]][[:alnum:]]*$/ ? name : quote_name(name) end