module Data.Text.ParagraphLayout.Internal.ParagraphOptions ( ParagraphOptions (..) , defaultParagraphOptions ) where import Data.Int (Int32) import Data.Text.Glyphize (Font, emptyFont) import Data.Text.ParagraphLayout.Internal.LineHeight -- | Defines options relevant to the entire paragraph. -- -- This record type is likely to be extended in the future. -- Use `defaultParagraphOptions` and update it with specific record selectors -- instead of constructing `ParagraphOptions` directly. data ParagraphOptions = ParagraphOptions { paragraphFont :: Font -- ^ Font to be used for shaping and measurement. -- Make sure to set its scale (see `Data.Text.Glyphize.optionScale`) using -- the same units that you want in the output. , paragraphLineHeight :: LineHeight -- ^ Preferred line height of the resulting fragments. , paragraphMaxWidth :: Int32 -- ^ Line width at which line breaking should occur. -- Lines will be broken at language-appropriate boundaries. -- If a line still exceeds this limit then, it will be broken at character -- boundaries, and if it already consists of a single cluster that cannot -- be further broken down, it will overflow. } deriving (Eq) -- | `ParagraphOptions` with default values. defaultParagraphOptions :: ParagraphOptions defaultParagraphOptions = ParagraphOptions { paragraphFont = emptyFont , paragraphLineHeight = Normal , paragraphMaxWidth = maxBound }