UISF-0.4.0.0: Library for Arrowized Graphical User Interfaces.

Copyright(c) Daniel Winograd-Cort 2015
Licensesee the LICENSE file in the distribution
Maintainerdwc@cs.yale.edu
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

FRP.UISF.Graphics.Text

Description

 

Synopsis

Documentation

newtype UIText Source

Text in UISF can be rendered in multiple fonts and colors, so we need a more powerful data type to encode it. The UIText data type does this.

Constructors

UIText 

class UITexty a where Source

To retain easy compatibility with Strings (or other text representations), we also provide the UITexty class, which is how all widgets that accept UIText should do so.

Methods

toUIText :: a -> UIText Source

uitextToString :: UIText -> String Source

Removes all font and color formatting from a UIText, returning its underlying String representation.

splitUIText :: Int -> UIText -> (UIText, UIText) Source

Split a UIText at the given character point.

takeUIText :: Int -> UIText -> UIText Source

Take a certain number of characters off of a UIText

dropUIText :: Int -> UIText -> UIText Source

Drop a certain number of characters from a UIText

uitextLen :: UIText -> Int Source

Returns the number of characters in a UIText.

pureUIText :: String -> UIText Source

Lifts a String to a UIText (with default color and font).

appendUIText :: (UITexty s1, UITexty s2) => s1 -> s2 -> UIText Source

Appends two UITexty objects together.

coloredUIText :: UITexty s => Color -> s -> UIText Source

Colors a UITexty object.

rgbUIText :: UITexty s => Maybe RGB -> s -> UIText Source

Colors a UITexty object with an exact RGB value.

fontUIText :: UITexty s => BitmapFont -> s -> UIText Source

Converts the UITexty object to the given font.

textWidth :: UITexty s => s -> Int Source

Returns the width of the String in pixels as it will be rendered

textWithinPixels :: UITexty s => Int -> s -> (UIText, UIText) Source

Given a String and a number of pixels, returns the leading substring that fits within the horizontal number of pixels along with the remaining text of the String.

textHeight :: UITexty s => s -> Int Source

Returns the height of the String in pixels as it will be rendered

data WrapSetting Source

The Wrap Setting is used to determine how to split up a long piece of text.

Constructors

NoWrap 
CharWrap 
WordWrap 

prepText Source

Arguments

:: UITexty s 
=> WrapSetting

Whether we prefer newer or older text

-> Double

Line spacing

-> Rect

Bounding Box

-> s

The text to print (which is allowed to have new lines)

-> ([Point], [UIText]) 

Turn the given String into a list of Strings. If the wrap setting is NoWrap, then this is basically just the lines function. If it is CharWrap or WordWrap, then no string in the list will be wider than the width of the bounding box. The returned list of points indicate each Point where a line should be drawn. Note that this list may not be the same length as the list of strings.

Typically, this will be used in conjunction with zip and textLines to produce text graphics.

textWidth' :: BitmapFont -> String -> Int Source

Returns the text width of a String rendered in the given bitmap font.

textWithinPixels' :: BitmapFont -> Int -> String -> (String, String) Source

Splits a String based on what can fit within the given number of pixels (the fst of the result) and what's left over (the snd).

textHeight' :: BitmapFont -> String -> Int Source

Returns the text height of a String rendered in the given bitmap font.

uitextLines :: UIText -> [UIText] Source

The common String lines function applicable to UIText.

uitextWords :: UIText -> [UIText] Source

The common String words function applicable to UIText.

data BitmapFont :: *

The bitmap fonts available in GLUT. The exact bitmap to be used is defined by the standard X glyph bitmaps for the X font with the given name.

Constructors

Fixed8By13

A fixed width font with every character fitting in an 8 by 13 pixel rectangle. (-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1)

Fixed9By15

A fixed width font with every character fitting in an 9 by 15 pixel rectangle. (-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1)

TimesRoman10

A 10-point proportional spaced Times Roman font. (-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1)

TimesRoman24

A 24-point proportional spaced Times Roman font. (-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1)

Helvetica10

A 10-point proportional spaced Helvetica font. (-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1)

Helvetica12

A 12-point proportional spaced Helvetica font. (-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1)

Helvetica18

A 18-point proportional spaced Helvetica font. (-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1)