| Copyright | (C) 2014-2015 The University of Kansas |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Andy Gill |
| Stability | Beta |
| Portability | GHC |
| Safe Haskell | None |
| Language | Haskell2010 |
Graphics.Blank.Font
Contents
Description
This module exposes an overloaded version of the font function that can accept
a Font ADT argument. This may be of interest if you desire stronger type safety
than Text-based fonts provide.
Note that this module's font function conflicts with font from Graphics.Blank.
Make sure to hide font from Graphics.Blank if you use font from this module.
Synopsis
- font :: CanvasFont canvasFont => canvasFont -> Canvas ()
- class CanvasFont a where
- data Font
- defFont :: [FontFamily] -> Font
- caption :: Font
- icon :: Font
- menu :: Font
- messageBox :: Font
- smallCaption :: Font
- statusBar :: Font
- data FontStyle
- italic :: FontStyle
- oblique :: FontStyle
- data FontVariant
- smallCaps :: FontVariant
- data FontWeight
- bold :: FontWeight
- bolder :: FontWeight
- lighter :: FontWeight
- data FontSize
- xxSmall :: FontSize
- xSmall :: FontSize
- small :: FontSize
- medium :: FontSize
- large :: FontSize
- xLarge :: FontSize
- xxLarge :: FontSize
- larger :: FontSize
- smaller :: FontSize
- data LineHeight
- data FontFamily
- serif :: FontFamily
- sansSerif :: FontFamily
- monospace :: FontFamily
- cursive :: FontFamily
- fantasy :: FontFamily
- class Default a => NormalProperty a where
- data Length
- class LengthProperty a where
- em :: LengthProperty a => Double -> a
- ex :: LengthProperty a => Double -> a
- ch :: LengthProperty a => Double -> a
- rem_ :: LengthProperty a => Double -> a
- vh :: LengthProperty a => Double -> a
- vw :: LengthProperty a => Double -> a
- vmin :: LengthProperty a => Double -> a
- vmax :: LengthProperty a => Double -> a
- px :: LengthProperty a => Double -> a
- mm :: LengthProperty a => Double -> a
- cm :: LengthProperty a => Double -> a
- in_ :: LengthProperty a => Double -> a
- pt :: LengthProperty a => Double -> a
- pc :: LengthProperty a => Double -> a
- class PercentageProperty a where
Overloaded font
font :: CanvasFont canvasFont => canvasFont -> Canvas () #
class CanvasFont a where #
A data type that can represent a browser font.
Minimal complete definition
Methods
jsCanvasFont :: a -> Builder #
Convert a value into a JavaScript string representing a font value.
Instances
| CanvasFont Text # | |
Defined in Graphics.Blank.Types.Font Methods jsCanvasFont :: Text -> Builder # | |
| CanvasFont Font # | |
Defined in Graphics.Blank.Types.Font Methods jsCanvasFont :: Font -> Builder # | |
font
A CSS-style font data type.
Constructors
| FontProperties | A font specified by its individual longhand properties. |
Fields
| |
| CaptionFont | The font used for captioned controls (e.g., buttons, drop-downs, etc.) |
| IconFont | The font used to label icons. |
| MenuFont | The font used in menus (e.g., dropdown menus and menu lists). |
| MessageBoxFont | The font used in dialog boxes. |
| SmallCaptionFont | The font used for labeling small controls. |
| StatusBarFont | The font used in window status bars. |
Instances
| Eq Font # | |
| Ord Font # | |
| Read Font # | |
| Show Font # | |
| IsString Font # | |
Defined in Graphics.Blank.Types.Font Methods fromString :: String -> Font # | |
| TextShow Font # | |
Defined in Graphics.Blank.Types.Font | |
| JSArg Font # | |
Defined in Graphics.Blank.Types.Font | |
| CanvasFont Font # | |
Defined in Graphics.Blank.Types.Font Methods jsCanvasFont :: Font -> Builder # | |
defFont :: [FontFamily] -> Font #
Creates a new font from the FontFamily list, using the Default instances
for the other five longhand properties. If you only wish to change certain
properties and leave the others alone, this provides a convenient mechanism
for doing so:
(defFont["Gill Sans Extrabold",sansSerif]) {fontStyle=italic,fontSize= 12 #px,lineHeight= 14 #px}
Shorthand for CaptionFont.
messageBox :: Font #
Shorthand for MessageBoxFont.
smallCaption :: Font #
Shorthand for SmallCaptionFont.
Shorthand for StatusBarFont.
font-style
Specifies if a Font is italic or oblique.
Constructors
| NormalStyle | Selects a font classified as normal (default). |
| ItalicStyle | Selects a font that is labeled italic, or if one is not available, one labeled oblique. |
| ObliqueStyle | Selects a font that is labeled oblique. |
Instances
Shorthand for ItalicStyle.
Shorthand for ObliqueStyle.
font-variant
data FontVariant #
Specifies the face of a Font.
Constructors
| NormalVariant | A normal font face (default). |
| SmallCapsVariant | A font face with small capital letters for lowercase characters. |
Instances
Shorthand for SmallCapsVariant.
font-weight
data FontWeight #
Specifies the boldness of a Font. Note that FontWeight is an instance of
Num so that the nine numeric weights can be used directly. For example:
(defFont[sansSerif]) {fontWeight= 900 }
Attempting to use a numeric weight other than the nine given will result in a runtime error.
Constructors
| NormalWeight | Default. |
| BoldWeight | |
| BolderWeight | |
| LighterWeight | |
| Weight100 | |
| Weight200 | |
| Weight300 | |
| Weight400 | |
| Weight500 | |
| Weight600 | |
| Weight700 | |
| Weight800 | |
| Weight900 |
Instances
bold :: FontWeight #
Shorthand for BoldWeight.
bolder :: FontWeight #
Shorthand for BolderWeight.
lighter :: FontWeight #
Shorthand for LighterWeight.
font-size
The desired height of Font glyphs.
Examples
Constructors
| XXSmallSize | |
| XSmallSize | |
| SmallSize | |
| MediumSize | Default. |
| LargeSize | |
| XLargeSize | |
| XXLargeSize | |
| LargerSize | |
| SmallerSize | |
| FontSizeLength Length | |
| FontSizePercentage Percentage |
Instances
| Eq FontSize # | |
| Ord FontSize # | |
Defined in Graphics.Blank.Types.Font | |
| Read FontSize # | |
| Show FontSize # | |
| IsString FontSize # | |
Defined in Graphics.Blank.Types.Font Methods fromString :: String -> FontSize # | |
| Default FontSize # | |
Defined in Graphics.Blank.Types.Font | |
| TextShow FontSize # | |
| PercentageProperty FontSize # | |
Defined in Graphics.Blank.Types.Font Methods percent :: Percentage -> FontSize # | |
| LengthProperty FontSize # | |
Defined in Graphics.Blank.Types.Font Methods fromLength :: Length -> FontSize # | |
Shorthand for XXSmallSize.
Shorthand for XSmallSize.
Shorthand for MediumSize.
Shorthand for XLargeSize.
Shorthand for XXLargeSize.
Shorthand for LargerSize.
Shorthand for SmallerSize.
line-height
data LineHeight #
The height of the line boxes in a Font.
Examples
(defFont[sansSerif]) {lineHeight=normal} (defFont[sansSerif]) {lineHeight= 50 } (defFont[sansSerif]) {lineHeight= 30 #em} (defFont[sansSerif]) {lineHeight= 70 #percent}
Constructors
| NormalLineHeight | Default. |
| LineHeightNumber Double | |
| LineHeightLength Length | |
| LineHeightPercentage Percentage |
Instances
font-family
data FontFamily #
The name of a Font family. Note that both FontFamily and [
are instances of FontFamily]IsString, so it is possible to produce FontFamily values
in several different ways. For example, these are all of type FontFamily:
FontFamilyName"Gill Sans Extrabold" "Gill Sans Extrabold" ::FontFamilyserif"serif" ::FontFamily
These are all of type [:FontFamily]
[FontFamilyName"Helvetica",serif] ["Helvetica", "serif"] :: [FontFamily] "Helvetica, serif" :: [FontFamily]
Constructors
| FontFamilyName Text | The name of a custom font family. |
| SerifFamily | A generic font family where glyphs have serifed endings. |
| SansSerifFamily | A generic font family where glyphs do not have serifed endings. |
| MonospaceFamily | A generic font family where all glyphs have the same fixed width. |
| CursiveFamily | A generic font family with cursive glyphs. |
| FantasyFamily | A generic font family where glyphs have decorative, playful representations. |
Instances
serif :: FontFamily #
Shorthand for SerifFamily.
sansSerif :: FontFamily #
Shorthand for SansSerifFamily.
monospace :: FontFamily #
Shorthand for MonospaceFamily.
cursive :: FontFamily #
Shorthand for CursiveFamily.
fantasy :: FontFamily #
Shorthand for FantasyFamily.
Normal values
class Default a => NormalProperty a where #
Methods
The default value for a CSS property. For example, it can be used like this:
(defFont[sansSerif]) {lineHeight=normal}
Instances
| NormalProperty LineHeight # | |
Defined in Graphics.Blank.Types.Font Methods normal :: LineHeight # | |
| NormalProperty FontWeight # | |
Defined in Graphics.Blank.Types.Font Methods normal :: FontWeight # | |
| NormalProperty FontVariant # | |
Defined in Graphics.Blank.Types.Font Methods normal :: FontVariant # | |
| NormalProperty FontStyle # | |
Defined in Graphics.Blank.Types.Font | |
Lengths
Denotes CSS distance measurements, especially in the context of Fonts.
Constructors
| Em | The height of the current font. |
| Ex | The height of the character |
| Ch | The width of the character |
| Rem | The height of the font relative to the root element. |
| Vh | One percent of the height of the viewport. |
| Vw | One percent of the width of the viewport. |
| Vmin | One percent of the minimum of the viewport height and width. |
| Vmax | One percent of the maximum of the viewport height and width. |
| Px | One device pixel (dot) of the display. |
| Mm | One millimeter. |
| Cm | One centimeter (10 millimeters). |
| In | One inch (~2.54 centimeters). |
| Pt | One point (1/72 inches). |
| Pc | One pica (12 points). |
Instances
| Eq Length # | |
| Ord Length # | |
| Read Length # | |
| Show Length # | |
| IsString Length # | |
Defined in Graphics.Blank.Types.CSS Methods fromString :: String -> Length # | |
| TextShow Length # | |
Defined in Graphics.Blank.Types.CSS | |
| LengthProperty Length # | |
Defined in Graphics.Blank.Types.CSS Methods fromLength :: Length -> Length # | |
class LengthProperty a where #
Designates CSS properties that can consist of a Length.
Minimal complete definition
Methods
fromLength :: Length -> a #
Instances
| LengthProperty Length # | |
Defined in Graphics.Blank.Types.CSS Methods fromLength :: Length -> Length # | |
| LengthProperty LineHeight # | |
Defined in Graphics.Blank.Types.Font Methods fromLength :: Length -> LineHeight # | |
| LengthProperty FontSize # | |
Defined in Graphics.Blank.Types.Font Methods fromLength :: Length -> FontSize # | |
em :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Em units.
ex :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Ex units.
ch :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Ch units.
rem_ :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Rem units. rem_ has an underscore
to distinguish it from rem.
vh :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Vh units.
vw :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Vw units.
vmin :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Em units.
vmax :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Vmax units.
px :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Px units.
mm :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Mm units.
cm :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Cm units.
in_ :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Im units. This function has an
underscore to distinguish it from the Haskell keyword.
pt :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Pt units.
pc :: LengthProperty a => Double -> a #
Constructs a LengthProperty value with Pc units.
Percentages
class PercentageProperty a where #
Designates CSS properties that can consist of a Percentage.
Minimal complete definition
Instances
| PercentageProperty Percentage # | |
Defined in Graphics.Blank.Types.CSS Methods percent :: Percentage -> Percentage # | |
| PercentageProperty LineHeight # | |
Defined in Graphics.Blank.Types.Font Methods percent :: Percentage -> LineHeight # | |
| PercentageProperty FontSize # | |
Defined in Graphics.Blank.Types.Font Methods percent :: Percentage -> FontSize # | |