opentype-0.1.1: Opentype loading and writing

Safe HaskellNone
LanguageHaskell98

Opentype.Fileformat.FontInfo

Description

This module implements a somewhat more logical structure containing font information, without the need for an in-depth study of the opentype spec.

Synopsis

Documentation

data FontInfo Source #

Currently only english strings are supported.

Constructors

FontInfo 

Fields

  • fontFamily :: String

    Font Family name, without subfamily classifiers such as Bold, Italic, etc...

  • fontVersion :: Int

    Font version, multiplied by 1000, for example use 1500 for version 1.5

  • fontUnitsPerEm :: FWord

    Number of units in an em-square. Should be a power of 2. Typical values are 1024 or 2048.

  • fontEmBase :: FWord

    Distance between the bottom of the em-square and the baseline in font design units.

  • fontLineGap :: FWord

    Linegap in font design units. Defined as distance between baselines - height of em square (fontUnitsPerEm).

  • fontWeight :: Weight

    Weight of the font. default: NormalWeight

  • fontWidth :: Width

    Width of the font. default: MediumWidth

  • fontSlant :: Slant

    Slant of the font. default: NoSlant

  • fontMonospaced :: Maybe Bool

    fixed width font. default: False

  • fontLowestRecPPEM :: Maybe Int

    Smallest readable size in pixels. default: 6

  • fontItalicAngle :: Maybe Double

    talic angle in counter-clockwise degrees from the vertical. Zero for upright text, negative for text that leans to the right (forward). default: 0

  • fontCaretOffset :: Maybe FWord

    The amount by which a slanted highlight on a glyph needs to be shifted to produce the best appearance. default: 0

  • fontSubScriptSize :: Maybe (FWord, FWord)

    The recommended size in font design units for subscripts for this font. default: (fontUnitsPerEM2, fontUnitsPerEM2)

  • fontSubScriptOffset :: Maybe (FWord, FWord)

    The recommended offset in font design units for subscripts for this font. default: (0, -fontUnitsPerEM/4)

  • fontSuperScriptSize :: Maybe (FWord, FWord)

    The recommended size in font design units for superscripts for this font. default: (fontUnitsPerEM2, fontUnitsPerEM2)

  • fontSuperScriptOffset :: Maybe (FWord, FWord)

    The recommended offset in font design units for superscripts for this font. default: (cos(90 + italicAngle)*snd superscriptYOffset, (fontUnitsPerEM-fontEmBase)/2)

  • fontEmbeddingLicence :: [EmbedLicence]

    ndicates font embedding licensing rights for the font. Embeddable fonts may be stored in a document. When a document with embedded fonts is opened on a system that does not have the font installed (the remote system), the embedded font may be loaded for temporary (and in some cases, permanent) use on that system by an embedding-aware application. Embedding licensing rights are granted by the vendor of the font. default: []

  • fontStrikoutSize :: Maybe FWord

    Width of the strikeout stroke in font design units. This field should normally be the width of the em dash for the current font. If the size is one, the strikeout line will be the line represented by the strikeout position field. If the value is two, the strikeout line will be the line represented by the strikeout position and the line immediately above the strikeout position. default: fontUnitsPerEm/20

  • fontStrikeoutPosition :: Maybe FWord

    The position of the top of the strikeout stroke relative to the baseline in font design units. Positive values represent distances above the baseline, while negative values represent distances below the baseline. A value of zero falls directly on the baseline, while a value of one falls one pel above the baseline. The value of strikeout position should not interfere with the recognition of standard characters, and therefore should not line up with crossbars in the font. default. fontUnitsPerEm/5.5

  • fontFamilyClass :: Maybe (Int, Int)

    The font class and font subclass are registered values assigned by IBM to each font family. This parameter is intended for use in selecting an alternate font when the requested font is not available. The font class is the most general and the font subclass is the most specific. The high byte of this field contains the family class, while the low byte contains the family subclass. See https://www.microsoft.com/typography/otspec/ibmfc.htm for more information. default: (0,0)

  • fontVendorID :: Maybe (Char, Char, Char, Char)

    The four character identifier for the vendor of the given type face. This is not the royalty owner of the original artwork. This is the company responsible for the marketing and distribution of the typeface that is being classified. It is reasonable to assume that there will be 6 vendors of ITC Zapf Dingbats for use on desktop platforms in the near future (if not already). It is also likely that the vendors will have other inherent benefits in their fonts (more kern pairs, unregularized data, hand hinted, etc.). This identifier will allow for the correct vendor's type to be used over another, possibly inferior, font file. The Vendor ID value is not required. default: (' ', ' ', ' ', ' ')

  • fontPanose :: Maybe (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)

    Panose-1 Classification. default: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

  • fontUnicodeRanges :: Maybe (Word32, Word32, Word32, Word32)

    Supported Unicode Ranges: See https://www.microsoft.com/typography/otspec/os2.htm#ur. default (3, 0, 0, 0)

  • fontCodepageRanges :: Maybe (Word32, Word32)

    Supported Codepage Ranges. See https://www.microsoft.com/typography/otspec/os2.htm#cpr. default: (1, 0)

  • fontXHeight :: Maybe FWord

    This metric specifies the distance between the baseline and the approximate height of non-ascending lowercase letters measured in FUnits. default height of glyph at U+0078 (LATIN SMALL LETTER X)

  • fontCapHeight :: Maybe FWord

    This metric specifies the distance between the baseline and the approximate height of uppercase letters measured in FUnits. default height of glyph at U+0048 (LATIN CAPITAL LETTER H).

  • fontLowerOpticalPointSize :: Maybe Int

    This field is used for fonts with multiple optical styles.

    This value is the lower value of the size range for which this font has been designed. The units for this field are TWIPs (one-twentieth of a point, or 1440 per inch). The value is inclusive—meaning that that font was designed to work best at this point size through, but not including, the point size indicated by usUpperOpticalPointSize. When used with other optical fonts that set usLowerOpticalPointSize and usUpperOpticalPointSize, it would be expected that another font has this same value as this entry in the usUpperOpticalPointSize field, unless this font is designed for the lowest size range. The smallest font in an optical size set should set this value to 0.When working across multiple optical fonts, there should be no intentional gaps or overlaps in the ranges. usLowerOpticalPointSize must be less than usUpperOpticalPointSize. The maximum valid value is 0xFFFE. default: 0

  • fontUpperOpticalPointSize :: Maybe Int

    fontUpperOptThis field is used for fonts with multiple optical styles.

    This value is the upper value of the size range for which this font has been designed. The units for this field are TWIPs (one-twentieth of a point, or 1440 per inch). The value is exclusive—meaning that that font was designed to work best below this point size down to the usLowerOpticalPointSize threshold. When used with other optical fonts that set usLowerOpticalPointSize and usUpperOpticalPointSize, it would be expected that another font has this same value as this entry in the usLowerOpticalPointSize field, unless this font is designed for the highest size range. The largest font in an optical size set should set this value to 0xFFFF, which is interpreted as infinity. When working across multiple optical fonts, there should be no intentional or overlaps left in the ranges. usUpperOpticalPointSize must be greater than usLowerOpticalPointSize. The minimum valid value for this field is 2 (two). The largest possible inclusive point size represented by this field is 3276.65 points, any higher values would be represented as infinity. default: 0xffff

  • fontUnderlinePosition :: Maybe FWord

    This is the suggested distance of the top of the underline from the baseline (negative values indicate below baseline). The PostScript definition of this FontInfo dictionary key (the y coordinate of the center of the stroke) is not used for historical reasons. The value of the PostScript key may be calculated by subtracting half the underlineThickness from the value of this field. default: default -fontUnitsPerEm/8

  • fontUnderlineThickness :: Maybe FWord

    suggested values for the underline thickness. default fontUnitsPerEm/10

  • fontSubFamilyExtra :: String

    This field is used when the font has a subfamily other than Weight, Width or Slant. Should not include any width, weight or slant descriptions. default: ""

  • fontDecoration :: [Decoration]

    Set if the font has any of these decorations. default: []

  • fontCopyright :: String

    Copyright notice. Default: []

  • fontID :: String

    Unique font identifier

  • fontPsName :: String

    postscriptName. default: full name with hyphen substituted for spaces.

  • fontTrademark :: String

    trademark. default: ""

  • fontManufacturer :: String

    Manufacturer Name. default: ""

  • fontDesigner :: String

    name of the designer of the typeface. default: ""

  • fontLicence :: String

    description of how the font may be legally used, or different example scenarios for licensed use. This field should be written in plain language, not legalese. default: ""

  • fontDescription :: String

    description of the typeface. Can contain revision information, usage recommendations, history, features, etc.

  • fontLicenceUrl :: String

    URL where additional licensing information can be found. default ""

  • fontDesignerUrl :: String

    URL of typeface designer (with protocol, e.g., http://, ftp://).

  • fontVendorUrl :: String

    URL of font vendor (with protocol, e.g., http://, ftp://). If a unique serial number is embedded in the URL, it can be used to register the font.

  • fontSampleText :: String

    This can be the font name, or any other text that the designer thinks is the best sample to display the font in. default: ""

  • fontLightPalette :: String

    This ID, if used in the CPAL table’s Palette Labels Array, specifies that the corresponding color palette in the CPAL table is appropriate to use with the font when displaying it on a light background such as white. Name table strings for this ID specify the user interface strings associated with this palette. default ""

  • fontDarkPalette :: String

    Dark Backgound Palette. This ID, if used in the CPAL table’s Palette Labels Array, specifies that the corresponding color palette in the CPAL table is appropriate to use with the font when displaying it on a dark background such as black. Name table strings for this ID specify the user interface strings associated with this palette

  • fontCreated :: UTCTime

    font creation time

  • fontModified :: Maybe UTCTime

    font modification time. default: creation time.

data Slant Source #

Constructors

Italic 
Oblique 
NoSlant 

Instances

Eq Slant Source # 

Methods

(==) :: Slant -> Slant -> Bool #

(/=) :: Slant -> Slant -> Bool #

Show Slant Source # 

Methods

showsPrec :: Int -> Slant -> ShowS #

show :: Slant -> String #

showList :: [Slant] -> ShowS #

data EmbedLicence Source #

Constructors

RestrictedEmbedding

Fonts must not be modified, embedded or exchanged in any manner without first obtaining permission of the legal owner. Caution: For Restricted License embedding to take effect, it must be the only level of embedding selected.

PrintPreview

The font may be embedded, and temporarily loaded on the remote system. Documents containing Preview & Print fonts must be opened “read-only;” no edits can be applied to the document.

EditEmbed

The font may be embedded but must only be installed temporarily on other systems. In contrast to Preview & Print fonts, documents containing Editable fonts may be opened for reading, editing is permitted, and changes may be saved.

NoSubsetEmbed

When this bit is set, the font may not be subsetted prior to embedding. Other embedding restrictions also apply.

OnlyBitmapEmbed

When this bit is set, only bitmaps contained in the font may be embedded. No outline data may be embedded. If there are no bitmaps available in the font, then the font is considered unembeddable and the embedding services will fail. Other embedding restrictions specified in bits 0-3 and 8 also apply.

infoToTables :: FontInfo -> (HeadTable, HheaTable, NameTable, PostTable, OS2Table) Source #

Fill in font information into the font tables