on master help sign in
Add Graphics.Vty.UnicodeWidthTable.Types (data types for unicode width tables)
commit345c0bfa64a03d6f755747303a47ed3250befb00 authorJonathan Daugherty <cygnus@foobox.com> dateThu 27 Feb 2020, 15:00 (7 years ago) parentbd8a18c
2 files changed+29
src/Graphics/Vty/UnicodeWidthTable/Types.hs+28 vty.cabal+1
src/Graphics/Vty/UnicodeWidthTable/Types.hsnew file+28
@@ -0,0 +1,28 @@
1+module Graphics.Vty.UnicodeWidthTable.Types
2+ ( UnicodeWidthTable(..)
3+ , WidthTableRange(..)
4+ )
5+where
6+
7+import Data.Word (Word8, Word32)
8+
9+-- | A range of code points in a width table.
10+data WidthTableRange =
11+ WidthTableRange { rangeStart :: Word32
12+ -- ^ The range's starting code point.
13+ , rangeSize :: Word32
14+ -- ^ The number of code points in the range,
15+ -- including the starting code point.
16+ , rangeColumns :: Word8
17+ -- ^ The terminal width, in columns, of all of the
18+ -- characters corresponding to the code points in
19+ -- this range.
20+ }
21+ deriving (Eq, Show)
22+
23+-- | A table of Unicode character widths.
24+data UnicodeWidthTable =
25+ UnicodeWidthTable { unicodeWidthTableRanges :: [WidthTableRange]
26+ -- ^ The ranges in the table.
27+ }
28+ deriving (Show)
vty.cabal+1
@@ -99,6 +99,7 @@ library
9999 Graphics.Vty.Output.Interface
100100 Graphics.Vty.Output.XTermColor
101101 Graphics.Vty.Output.TerminfoBased
102+ Graphics.Vty.UnicodeWidthTable.Types
102103
103104 other-modules: Graphics.Vty.Attributes.Color240
104105 Graphics.Vty.Debug.Image