├── README.md ├── assets ├── scrolling-indicator-1024.png ├── scrolling-indicator-1024.png.txt ├── scrollingfieldindicatoricon-down.png ├── scrollingfieldindicatoricon-down.png.txt ├── scrollingfieldindicatoricon-down@2x.png ├── scrollingfieldindicatoricon-down@2x.png.txt ├── scrollingfieldindicatoricon-up.png ├── scrollingfieldindicatoricon-up.png.txt ├── scrollingfieldindicatoricon-up@2x.png └── scrollingfieldindicatoricon-up@2x.png.txt ├── entities.lua ├── examples ├── _ui │ ├── button-cancel-over.png │ ├── button-cancel-round-over.png │ ├── button-cancel-round.png │ ├── button-cancel.png │ ├── popup-black-landscape.png │ ├── popup-black.png │ ├── popup-white-landscape.png │ └── popup-white.png ├── assets │ ├── scrollbar-1.jpg │ ├── scrollbar-2.jpg │ ├── scrollbar-3.jpg │ ├── text-render-sample.backup.html │ ├── text-render-sample.html │ └── textstyles.txt ├── build.settings ├── config.lua ├── main.lua └── scripts │ ├── funx.lua │ ├── funx │ ├── popup-black.png │ ├── popup-white.png │ ├── spinner.lua │ └── spinner.png │ └── textrender │ ├── README.md │ ├── assets │ ├── scrolling-indicator-1024.png │ ├── scrolling-indicator-1024.png.txt │ ├── scrollingfieldindicatoricon-down.png │ ├── scrollingfieldindicatoricon-down.png.txt │ ├── scrollingfieldindicatoricon-down@2x.png │ ├── scrollingfieldindicatoricon-down@2x.png.txt │ ├── scrollingfieldindicatoricon-up.png │ ├── scrollingfieldindicatoricon-up.png.txt │ ├── scrollingfieldindicatoricon-up@2x.png │ └── scrollingfieldindicatoricon-up@2x.png.txt │ ├── entities.lua │ ├── fontmetrics.lua │ ├── fontmetrics.txt │ ├── fontvariations.txt │ ├── html.lua │ ├── textrender.lua │ ├── textstyles-rgb.txt │ └── textstyles.txt ├── fontmetrics.lua ├── fontmetrics.txt ├── fontvariations.txt ├── html.lua ├── textrender.lua ├── textstyles-rgb.txt └── textstyles.txt /README.md: -------------------------------------------------------------------------------- 1 | corona-textrender 2 | ====================== 3 | 4 | ## Synopsis 5 | 6 | A pure-Lua text rendering module for Corona SDK which can handle basic HTML, fonts, font-styles, and even basic font metrics. 7 | 8 | 9 | ## Options 10 | The function uses a table with options. 11 | 12 | text : [string] The text to render. It can be HTML or unstyled text. 13 | 14 | width : [number] width of the column of text in pixels 15 | 16 | maxHeight : [number] Maximum height of the text block. Extra text is not rendered. 17 | 18 | isHTML : [boolean] Set to true if the text is simplified HTML styled text. Default is true. 19 | 20 | useHTMLSpacing : [boolean] Set to true to change all returns and tabs and double-spaces to a single space, as with HTML in a browser. Default is true. 21 | 22 | testing = false, -- [boolean] True for testing, shows borders and colors. 23 | 24 | 25 | ### Font Defaults 26 | 27 | font : [string] The iOS or Android font name, e.g. "AvenirNext-Regular". Don't use Postscript names, they won't work. See http://iosfonts.com for a list of built-in iOS fonts. 28 | 29 | size : [number] The default font size. Changed by any style settings in the text. 30 | 31 | lineHeight : [number] The default line height. Changed by any style settings in the text. 32 | 33 | color : [table] The default font color. Changed by any style settings in the text. Use an RGBa table, like this: {0, 0, 0, 1} (black type) 34 | 35 | opacity : [number] The default font opacity (or alpha). Changed by any style settings in the text. Use a number, e.g. 0.3 or a percentage in a string, e.g. "80%" 36 | 37 | alignment : [number] Default text alignment, note the initial capital letter. "Left" | "Right" | "Center" 38 | 39 | ### Caching Settings 40 | This module caches the text rendering so that the second time you show the text, it appears much faster. It uses some heuristics (i.e. guesses) for speed. You don't have to set any of this. You can just use the defaults. 41 | 42 | minCharCount : [number] Minimum number of characters per line. Start low, like 5. 43 | 44 | cacheToDB : [boolean] Default is true. Set to false for no caching. Uses sqlite3 caching (faster). 45 | 46 | cacheDir : [string] If cacheToDB is false, then try this method for caching. If this value is set to the _full path_ to the cache directory to use for json file caching (slower). 47 | 48 | 49 | minWordLen : [number] 2, - Minimum length of a word shown at the end of a line, e.g. don't end lines with "a". 50 | 51 | ### Text Style Sheets 52 | 53 | textstyles : [table] The styles table. Load the table using using funx.loadTextStyles 54 | 55 | defaultStyle : [sring] The name of the the default style (from textstyles.txt) for text, default is "Normal". 56 | 57 | 58 | ### Hyperlinks 59 | 60 | handler : [function] A function that will accept a 'tap' event on a hyperlink. 61 | 62 | hyperlinkFillColor : [string] The fill of a box surrounding a hyperlink.An RGBa color in a string, like this: "200,120,255,100". Note, this value must be set in your code...there is no textstyle for it. 63 | 64 | hyperlinkTextColor : [string] The color of text of hyperlink. An RGBa color in a string, like this: "200,120,255,100" 65 | 66 | You can also set the hyperlink text color by creating an "a" tag in the textstyles.txt document. Hyperlinks use the HTML "a" tag (like a "p" or "ol"), so that style will be applied. 67 | 68 | 69 | ### Unused or In Development 70 | Here are some options that I started work on but never finished or found no current use for. 71 | 72 | ~~targetDeviceScreenSize : [string] The screen dimensions as "width,height", e.g. "1024,768" This is the target screen size, used to resize text to be readable on different screens~~ 73 | 74 | ~~letterspacing : [number] Letterspacing in pixels. (PLANNED, NOT IN USE)~~ 75 | 76 | 77 | 78 | 79 | ## Code Example 80 | 81 | ``` 82 | -- Load the module 83 | local funx = require("scripts.funx") 84 | local textrender = require("scripts.textrender.textrender") 85 | local textStyles = funx.loadTextStyles("scripts/textrender/textstyles.txt", system.ResourceDirectory) 86 | 87 | ------------ 88 | -- For TESTING, we clear text caches so we can see changes to our code and texts. 89 | -- We clear the cache before begining, so first render creates a cache, second uses it. 90 | textrender.clearAllCaches(cacheDir) 91 | 92 | ------------ 93 | -- Sample text 94 | local mytext = [[ 95 |

96 | Hit events propagate until they are handled. This means that if you have multiple objects overlaying each other in the display hierarchy, and a hit event listener has been applied to each, the hit event will propagate through all of these objects. 97 |

98 |

99 | Hit events propagate until they are handled. This means that if you have multiple objects overlaying each other in the display hierarchy, and a hit event listener has been applied to each, the hit event will propagate through all of these objects. 100 |

101 | ]] 102 | 103 | local options = { 104 | text = mytext, 105 | font = "AvenirNext-Regular", 106 | size = "12", 107 | lineHeight = "16", 108 | color = {0, 0, 0, 255}, 109 | opacity = "100%", 110 | width = w, -- width of the column of text 111 | alignment = "Left", -- default text alignment, note the initial capital letter 112 | minCharCount = 5, -- Minimum number of characters per line. Start low. 113 | targetDeviceScreenSize = screenW..","..screenH, -- Target screen size, may be different from current screen size 114 | letterspacing = 0, 115 | maxHeight = screenH - 50, 116 | minWordLen = 2, - Minimum length of a word shown at the end of a line, e.g. don't end lines with "a". 117 | textstyles = textStyles, -- styles table, loaded using funx.loadTextStyles 118 | defaultStyle = "Normal", -- default style (from textstyles.txt) for text 119 | cacheToDB = true, -- default is true, set to false for no caching, uses sqlite3 caching (faster) 120 | cacheDir = nil, -- Set to cache directory name to use json file caching (slow) 121 | handler = handler, -- a function that will accept a 'tap' event 122 | hyperlinkFillColor = hyperlinkFillColor, -- an RGBa color in a string, like this: "200,120,255,100" 123 | hyperlinkTextColor = hyperlinkTextColor, -- an RGBa color in a string, like this: "200,120,255,100" 124 | isHTML = true, -- TRUE if the text is simplified HTML styled text 125 | useHTMLSpacing = true, -- if TRUE, then change all returns and tabs and double-spaces to a single space 126 | testing = false, -- [boolean] True for testing, shows borders and colors. 127 | } 128 | local textblock = textwrap.autoWrappedText( options ) 129 | ``` 130 | 131 | 132 | ## Style Sheets 133 | The module uses style sheets of predefined styles. It does render many HTML attributes, such as color and fontsize, so a great deal of HTML will work without change. 134 | 135 | You load the style sheet before calling the textrender() function. This way, you only need to load it once, and that's faster. 136 | 137 | A stylesheet is a simple format. Each style is a line, beginning with a name, like this: 138 | 139 | style = font, size, leading, R,G,B, width, opacity, NORMAL|ALL_CAPS, text alignment, spaceBefore, spaceAfter, firstLineIndent, leftIndent, rightIndent 140 | 141 | Use a '#' to comment a line. 142 | 143 | Here is an example (note the colors use the 2.0 version of Corona with values between 0 and 1): 144 | ``` 145 | # TEXT STYLES FOR CORONA GRAPHICS v2 (values between 0-1) 146 | 147 | # style = font, size, leading, R,G,B, width, opacity, NORMAL|ALL_CAPS, text alignment, spaceBefore, spaceAfter, firstLineIndent, leftIndent, rightIndent 148 | 149 | #generic styles 150 | Normal = Avenir-Book,16,20,0,0,0,,100% 151 | Heading = Avenir-Bold,16,20,0,0,0,,100% 152 | Title=Avenir-Light,24,40,0.5,0.5,0.5,,100%,NORMAL,left,10,6,0,0,0 153 | H1=,18,26,0,0,0,,100%,NORMAL,left,12,4,0,0,0 154 | H2=Avenir-Book,18,26,0,0,0,,100%,NORMAL,left,12,4,0,0,0 155 | H2 Light=Avenir-Book,18,26,220,220,220,,100%,NORMAL,left,12,4,0,0,0 156 | H3=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 157 | H4=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 158 | H6=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 159 | H5=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 160 | Quote = Avenir-Light,20,28,200,255,20,,100% 161 | ``` 162 | 163 | ## HTML Tags 164 | The module recognizes the following HTML tags. 165 | - p 166 | ``

text

167 | - br 168 | - ol, li 169 | - b,i,em, strong 170 | - font 171 | - sup, sub 172 | - a 173 | - img 174 | 175 | 176 | ## Notes: 177 | 178 | ###Hyperlinking 179 | 180 | handler : a function that will use a 'tap' event. Note that event.target._attr contains the HTML attributes of the hyperlink, e.g. href, style, class, whatever your throw in. 181 | In the example, the function will get 'makeSound' as the href, and it can do the appropriate action. 182 | You can pass any attribute you need, such as a page number or URL, of course.
183 | Example: <a href="makeSound" style="font-size:24;">My Link</a> 184 | 185 | ###Parts of the module 186 | - textrender.lua : the module that renders a piece of text. The text can have basic HTML coding (p, br, i, em, b, li, ol), as well as my built-in paragraph formatting. It will also read the 'class' attribute of HTML to figure out the style, then apply the style from the textstyles.txt file! 187 | - HTML support: entities.lua, html.lua : these are open source modules I found and modified to handle HTML 188 | - fontmetrics.lua, fontmetrics.txt, fontvariations.txt : this module and files let the textwrap module position type correctly on the screen. Normally, you can't position with baseline, but these modules let us do that. 189 | - funx.lua : a large collection of useful functions 190 | 191 | 192 | ## Motivation 193 | 194 | Corona SDK does not offer styled text, and this code makes it easy to take existing HTML text and use it. 195 | Also, Corona SDK does not position text using font metrics. Therefore it is very hard to write code that will show text as it appears in layout programs. 196 | 197 | ## Installation 198 | 199 | In your main Corona app folder, create a folder named "scripts". From the "scripts" folder in this repo, copy these folders to your scripts folder. 200 | * funx.lua 201 | * textrender 202 | 203 | Your app folder should now look something like this: 204 | * main folder 205 | * main.lua (your main file) 206 | * scripts 207 | * funx.lua 208 | * textrender 209 | 210 | 211 | ## Tests 212 | 213 | NA 214 | ## Contributors 215 | 216 | This was created by me! 217 | 218 | ## License 219 | 220 | The MIT License (MIT) 221 | 222 | Copyright (c) 2015 David Gross 223 | 224 | Permission is hereby granted, free of charge, to any person obtaining a copy 225 | of this software and associated documentation files (the "Software"), to deal 226 | in the Software without restriction, including without limitation the rights 227 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 228 | copies of the Software, and to permit persons to whom the Software is 229 | furnished to do so, subject to the following conditions: 230 | 231 | The above copyright notice and this permission notice shall be included in all 232 | copies or substantial portions of the Software. 233 | 234 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 235 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 236 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 237 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 238 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 239 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 240 | SOFTWARE. 241 | -------------------------------------------------------------------------------- /assets/scrolling-indicator-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/assets/scrolling-indicator-1024.png -------------------------------------------------------------------------------- /assets/scrolling-indicator-1024.png.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/assets/scrolling-indicator-1024.png.txt -------------------------------------------------------------------------------- /assets/scrollingfieldindicatoricon-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/assets/scrollingfieldindicatoricon-down.png -------------------------------------------------------------------------------- /assets/scrollingfieldindicatoricon-down.png.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/assets/scrollingfieldindicatoricon-down.png.txt -------------------------------------------------------------------------------- /assets/scrollingfieldindicatoricon-down@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/assets/scrollingfieldindicatoricon-down@2x.png -------------------------------------------------------------------------------- /assets/scrollingfieldindicatoricon-down@2x.png.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/assets/scrollingfieldindicatoricon-down@2x.png.txt -------------------------------------------------------------------------------- /assets/scrollingfieldindicatoricon-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/assets/scrollingfieldindicatoricon-up.png -------------------------------------------------------------------------------- /assets/scrollingfieldindicatoricon-up.png.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/assets/scrollingfieldindicatoricon-up.png.txt -------------------------------------------------------------------------------- /assets/scrollingfieldindicatoricon-up@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/assets/scrollingfieldindicatoricon-up@2x.png -------------------------------------------------------------------------------- /assets/scrollingfieldindicatoricon-up@2x.png.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/assets/scrollingfieldindicatoricon-up@2x.png.txt -------------------------------------------------------------------------------- /entities.lua: -------------------------------------------------------------------------------- 1 | -- convert numeric html entities to utf8 2 | -- converts from stdin to stdout 3 | -- example: € -> € 4 | -- from http://www.hpelbers.org/lua/utf8 5 | 6 | --- Functions for dealing with HTML/XML entities. 7 | 8 | local M = {} 9 | 10 | 11 | local char = string.char 12 | 13 | local function tail(n, k) 14 | local u, r='' 15 | for i=1,k do 16 | n,r = math.floor(n/0x40), n%0x40 17 | u = char(r+0x80) .. u 18 | end 19 | return u, n 20 | end 21 | 22 | local function to_utf8(a) 23 | if not a then return nil end 24 | local n, r, u = tonumber(a) 25 | if n<0x80 then -- 1 byte 26 | return char(n) 27 | elseif n<0x800 then -- 2 byte 28 | u, n = tail(n, 1) 29 | return char(n+0xc0) .. u 30 | elseif n<0x10000 then -- 3 byte 31 | u, n = tail(n, 2) 32 | return char(n+0xe0) .. u 33 | elseif n<0x200000 then -- 4 byte 34 | u, n = tail(n, 3) 35 | return char(n+0xf0) .. u 36 | elseif n<0x4000000 then -- 5 byte 37 | u, n = tail(n, 4) 38 | return char(n+0xf8) .. u 39 | else -- 6 byte 40 | u, n = tail(n, 5) 41 | return char(n+0xfc) .. u 42 | end 43 | end 44 | 45 | 46 | local character_entities = { 47 | ["quot"] = 0x0022, 48 | ["amp"] = 0x0026, 49 | ["apos"] = 0x0027, 50 | ["lt"] = 0x003C, 51 | ["gt"] = 0x003E, 52 | ["nbsp"] = 160, 53 | ["iexcl"] = 0x00A1, 54 | ["cent"] = 0x00A2, 55 | ["pound"] = 0x00A3, 56 | ["curren"] = 0x00A4, 57 | ["yen"] = 0x00A5, 58 | ["brvbar"] = 0x00A6, 59 | ["sect"] = 0x00A7, 60 | ["uml"] = 0x00A8, 61 | ["copy"] = 0x00A9, 62 | ["ordf"] = 0x00AA, 63 | ["laquo"] = 0x00AB, 64 | ["not"] = 0x00AC, 65 | ["shy"] = 173, 66 | ["reg"] = 0x00AE, 67 | ["macr"] = 0x00AF, 68 | ["deg"] = 0x00B0, 69 | ["plusmn"] = 0x00B1, 70 | ["sup2"] = 0x00B2, 71 | ["sup3"] = 0x00B3, 72 | ["acute"] = 0x00B4, 73 | ["micro"] = 0x00B5, 74 | ["para"] = 0x00B6, 75 | ["middot"] = 0x00B7, 76 | ["cedil"] = 0x00B8, 77 | ["sup1"] = 0x00B9, 78 | ["ordm"] = 0x00BA, 79 | ["raquo"] = 0x00BB, 80 | ["frac14"] = 0x00BC, 81 | ["frac12"] = 0x00BD, 82 | ["frac34"] = 0x00BE, 83 | ["iquest"] = 0x00BF, 84 | ["Agrave"] = 0x00C0, 85 | ["Aacute"] = 0x00C1, 86 | ["Acirc"] = 0x00C2, 87 | ["Atilde"] = 0x00C3, 88 | ["Auml"] = 0x00C4, 89 | ["Aring"] = 0x00C5, 90 | ["AElig"] = 0x00C6, 91 | ["Ccedil"] = 0x00C7, 92 | ["Egrave"] = 0x00C8, 93 | ["Eacute"] = 0x00C9, 94 | ["Ecirc"] = 0x00CA, 95 | ["Euml"] = 0x00CB, 96 | ["Igrave"] = 0x00CC, 97 | ["Iacute"] = 0x00CD, 98 | ["Icirc"] = 0x00CE, 99 | ["Iuml"] = 0x00CF, 100 | ["ETH"] = 0x00D0, 101 | ["Ntilde"] = 0x00D1, 102 | ["Ograve"] = 0x00D2, 103 | ["Oacute"] = 0x00D3, 104 | ["Ocirc"] = 0x00D4, 105 | ["Otilde"] = 0x00D5, 106 | ["Ouml"] = 0x00D6, 107 | ["times"] = 0x00D7, 108 | ["Oslash"] = 0x00D8, 109 | ["Ugrave"] = 0x00D9, 110 | ["Uacute"] = 0x00DA, 111 | ["Ucirc"] = 0x00DB, 112 | ["Uuml"] = 0x00DC, 113 | ["Yacute"] = 0x00DD, 114 | ["THORN"] = 0x00DE, 115 | ["szlig"] = 0x00DF, 116 | ["agrave"] = 0x00E0, 117 | ["aacute"] = 0x00E1, 118 | ["acirc"] = 0x00E2, 119 | ["atilde"] = 0x00E3, 120 | ["auml"] = 0x00E4, 121 | ["aring"] = 0x00E5, 122 | ["aelig"] = 0x00E6, 123 | ["ccedil"] = 0x00E7, 124 | ["egrave"] = 0x00E8, 125 | ["eacute"] = 0x00E9, 126 | ["ecirc"] = 0x00EA, 127 | ["euml"] = 0x00EB, 128 | ["igrave"] = 0x00EC, 129 | ["iacute"] = 0x00ED, 130 | ["icirc"] = 0x00EE, 131 | ["iuml"] = 0x00EF, 132 | ["eth"] = 0x00F0, 133 | ["ntilde"] = 0x00F1, 134 | ["ograve"] = 0x00F2, 135 | ["oacute"] = 0x00F3, 136 | ["ocirc"] = 0x00F4, 137 | ["otilde"] = 0x00F5, 138 | ["ouml"] = 0x00F6, 139 | ["divide"] = 0x00F7, 140 | ["oslash"] = 0x00F8, 141 | ["ugrave"] = 0x00F9, 142 | ["uacute"] = 0x00FA, 143 | ["ucirc"] = 0x00FB, 144 | ["uuml"] = 0x00FC, 145 | ["yacute"] = 0x00FD, 146 | ["thorn"] = 0x00FE, 147 | ["yuml"] = 0x00FF, 148 | ["OElig"] = 0x0152, 149 | ["oelig"] = 0x0153, 150 | ["Scaron"] = 0x0160, 151 | ["scaron"] = 0x0161, 152 | ["Yuml"] = 0x0178, 153 | ["fnof"] = 0x0192, 154 | ["circ"] = 0x02C6, 155 | ["tilde"] = 0x02DC, 156 | ["Alpha"] = 0x0391, 157 | ["Beta"] = 0x0392, 158 | ["Gamma"] = 0x0393, 159 | ["Delta"] = 0x0394, 160 | ["Epsilon"] = 0x0395, 161 | ["Zeta"] = 0x0396, 162 | ["Eta"] = 0x0397, 163 | ["Theta"] = 0x0398, 164 | ["Iota"] = 0x0399, 165 | ["Kappa"] = 0x039A, 166 | ["Lambda"] = 0x039B, 167 | ["Mu"] = 0x039C, 168 | ["Nu"] = 0x039D, 169 | ["Xi"] = 0x039E, 170 | ["Omicron"] = 0x039F, 171 | ["Pi"] = 0x03A0, 172 | ["Rho"] = 0x03A1, 173 | ["Sigma"] = 0x03A3, 174 | ["Tau"] = 0x03A4, 175 | ["Upsilon"] = 0x03A5, 176 | ["Phi"] = 0x03A6, 177 | ["Chi"] = 0x03A7, 178 | ["Psi"] = 0x03A8, 179 | ["Omega"] = 0x03A9, 180 | ["alpha"] = 0x03B1, 181 | ["beta"] = 0x03B2, 182 | ["gamma"] = 0x03B3, 183 | ["delta"] = 0x03B4, 184 | ["epsilon"] = 0x03B5, 185 | ["zeta"] = 0x03B6, 186 | ["eta"] = 0x03B7, 187 | ["theta"] = 0x03B8, 188 | ["iota"] = 0x03B9, 189 | ["kappa"] = 0x03BA, 190 | ["lambda"] = 0x03BB, 191 | ["mu"] = 0x03BC, 192 | ["nu"] = 0x03BD, 193 | ["xi"] = 0x03BE, 194 | ["omicron"] = 0x03BF, 195 | ["pi"] = 0x03C0, 196 | ["rho"] = 0x03C1, 197 | ["sigmaf"] = 0x03C2, 198 | ["sigma"] = 0x03C3, 199 | ["tau"] = 0x03C4, 200 | ["upsilon"] = 0x03C5, 201 | ["phi"] = 0x03C6, 202 | ["chi"] = 0x03C7, 203 | ["psi"] = 0x03C8, 204 | ["omega"] = 0x03C9, 205 | ["thetasym"] = 0x03D1, 206 | ["upsih"] = 0x03D2, 207 | ["piv"] = 0x03D6, 208 | ["ensp"] = 0x2002, 209 | ["emsp"] = 0x2003, 210 | ["thinsp"] = 0x2009, 211 | ["ndash"] = 0x2013, 212 | ["mdash"] = 0x2014, 213 | ["lsquo"] = 0x2018, 214 | ["rsquo"] = 0x2019, 215 | ["sbquo"] = 0x201A, 216 | ["ldquo"] = 0x201C, 217 | ["rdquo"] = 0x201D, 218 | ["bdquo"] = 0x201E, 219 | ["dagger"] = 0x2020, 220 | ["Dagger"] = 0x2021, 221 | ["bull"] = 0x2022, 222 | ["hellip"] = 0x2026, 223 | ["permil"] = 0x2030, 224 | ["prime"] = 0x2032, 225 | ["Prime"] = 0x2033, 226 | ["lsaquo"] = 0x2039, 227 | ["rsaquo"] = 0x203A, 228 | ["oline"] = 0x203E, 229 | ["frasl"] = 0x2044, 230 | ["euro"] = 0x20AC, 231 | ["image"] = 0x2111, 232 | ["weierp"] = 0x2118, 233 | ["real"] = 0x211C, 234 | ["trade"] = 0x2122, 235 | ["alefsym"] = 0x2135, 236 | ["larr"] = 0x2190, 237 | ["uarr"] = 0x2191, 238 | ["rarr"] = 0x2192, 239 | ["darr"] = 0x2193, 240 | ["harr"] = 0x2194, 241 | ["crarr"] = 0x21B5, 242 | ["lArr"] = 0x21D0, 243 | ["uArr"] = 0x21D1, 244 | ["rArr"] = 0x21D2, 245 | ["dArr"] = 0x21D3, 246 | ["hArr"] = 0x21D4, 247 | ["forall"] = 0x2200, 248 | ["part"] = 0x2202, 249 | ["exist"] = 0x2203, 250 | ["empty"] = 0x2205, 251 | ["nabla"] = 0x2207, 252 | ["isin"] = 0x2208, 253 | ["notin"] = 0x2209, 254 | ["ni"] = 0x220B, 255 | ["prod"] = 0x220F, 256 | ["sum"] = 0x2211, 257 | ["minus"] = 0x2212, 258 | ["lowast"] = 0x2217, 259 | ["radic"] = 0x221A, 260 | ["prop"] = 0x221D, 261 | ["infin"] = 0x221E, 262 | ["ang"] = 0x2220, 263 | ["and"] = 0x2227, 264 | ["or"] = 0x2228, 265 | ["cap"] = 0x2229, 266 | ["cup"] = 0x222A, 267 | ["int"] = 0x222B, 268 | ["there4"] = 0x2234, 269 | ["sim"] = 0x223C, 270 | ["cong"] = 0x2245, 271 | ["asymp"] = 0x2248, 272 | ["ne"] = 0x2260, 273 | ["equiv"] = 0x2261, 274 | ["le"] = 0x2264, 275 | ["ge"] = 0x2265, 276 | ["sub"] = 0x2282, 277 | ["sup"] = 0x2283, 278 | ["nsub"] = 0x2284, 279 | ["sube"] = 0x2286, 280 | ["supe"] = 0x2287, 281 | ["oplus"] = 0x2295, 282 | ["otimes"] = 0x2297, 283 | ["perp"] = 0x22A5, 284 | ["sdot"] = 0x22C5, 285 | ["lceil"] = 0x2308, 286 | ["rceil"] = 0x2309, 287 | ["lfloor"] = 0x230A, 288 | ["rfloor"] = 0x230B, 289 | ["lang"] = 0x27E8, 290 | ["rang"] = 0x27E9, 291 | ["loz"] = 0x25CA, 292 | ["spades"] = 0x2660, 293 | ["clubs"] = 0x2663, 294 | ["hearts"] = 0x2665, 295 | ["diams"] = 0x2666, 296 | } 297 | 298 | --- Given a string of decimal digits, returns a UTF-8 encoded 299 | -- string encoding a unicode character. 300 | function M.dec_entity(s) 301 | local out = string.gsub(s, '&#(%d+);', to_utf8) 302 | return out 303 | end 304 | 305 | --- Given a character entity name (like `ouml`), returns a UTF-8 encoded 306 | -- string encoding a unicode character. 307 | -- NOT WORKING: REQUIRES UNICODE. 308 | --[[function M.char_entity(s) 309 | local i = s:match('&(%a+);') 310 | local n = character_entities[i] 311 | local s 312 | if (n) then 313 | s = char(n) 314 | end 315 | return s 316 | end 317 | --]] 318 | 319 | function M.convert(s) 320 | if (s) then 321 | return M.dec_entity(s) 322 | else 323 | return s 324 | end 325 | end 326 | 327 | -- UNUSED 328 | -- Find the entity, get the character, OR return NIL 329 | --[[ 330 | local function get_character_entity(s) 331 | local c = character_entities[s] 332 | print ("C",c) 333 | if ( c ) then 334 | return char(c) 335 | end 336 | return nil 337 | end 338 | --]] 339 | 340 | local gsub, char = string.gsub, string.char 341 | local entitySwap = function(orig,n,s) 342 | local ss = to_utf8(tonumber(character_entities[s])) 343 | --print ("entitySwap: orig,n,s,ss",orig,ss,n,s) 344 | return ss or n=="#" and to_utf8(s) or orig 345 | end 346 | function M.unescape(str) 347 | return gsub( str, '(&(#?)([%d%a]+);)', entitySwap ) 348 | end 349 | 350 | --&#039; 351 | 352 | return M 353 | -------------------------------------------------------------------------------- /examples/_ui/button-cancel-over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/_ui/button-cancel-over.png -------------------------------------------------------------------------------- /examples/_ui/button-cancel-round-over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/_ui/button-cancel-round-over.png -------------------------------------------------------------------------------- /examples/_ui/button-cancel-round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/_ui/button-cancel-round.png -------------------------------------------------------------------------------- /examples/_ui/button-cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/_ui/button-cancel.png -------------------------------------------------------------------------------- /examples/_ui/popup-black-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/_ui/popup-black-landscape.png -------------------------------------------------------------------------------- /examples/_ui/popup-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/_ui/popup-black.png -------------------------------------------------------------------------------- /examples/_ui/popup-white-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/_ui/popup-white-landscape.png -------------------------------------------------------------------------------- /examples/_ui/popup-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/_ui/popup-white.png -------------------------------------------------------------------------------- /examples/assets/scrollbar-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/assets/scrollbar-1.jpg -------------------------------------------------------------------------------- /examples/assets/scrollbar-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/assets/scrollbar-2.jpg -------------------------------------------------------------------------------- /examples/assets/scrollbar-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/assets/scrollbar-3.jpg -------------------------------------------------------------------------------- /examples/assets/text-render-sample.backup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test 6 | 7 | 114 | 115 | 116 | 117 | 118 | 119 |

TextRender Example

120 | 121 |

122 | This is a sample HTML file for corona-textrender. 123 |

124 | 125 | 126 | This text does not have <p></p> wrapped around it.
127 | One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 128 |
129 | 130 |

131 | One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 132 |

133 | 134 |
135 | 136 |

137 | Hyperlinks appear HTML blue unless you specify your own color. You can also specify a background color instead of changing the text color for the hyperlink. Remember, hyperlinks execute functions you provide!

138 |

139 | This hyperlink also works. 140 |

141 |
142 | 143 |

Unordered List:

144 | 149 | 150 |
151 | 152 |

Ordered List:

153 |
    154 |
  1. One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species.
  2. 155 |
  3. Sub-List:
  4. 156 |
      157 |
    1. sub-item 1
    2. 158 |
    3. sub-item 2
    4. 159 |
    160 |
  5. Item 3
  6. 161 |
  7. This item is #10 by setting the 'value' attribute
  8. 162 |
  9. Another item
  10. 163 |
164 | 165 |
166 | 167 | 168 |

169 | Left-Indent Style: One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 170 |

171 | 172 |

173 | Left Style: One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 174 |

175 | 176 |

177 | Right Style: One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 178 |

179 | 180 |

181 | Center Style: One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 182 |

183 |
184 | 185 |
186 | The following text is not surrounded by <p>
187 | One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 188 | 189 |
190 | 191 |

192 | Here is an example of the <sup> and <sub> tags. Note the extra spaces so the super/subscripts don't crowd each other. 193 |
194 |
195 | 2 + 2 2 3 - x n i= 6 196 |

197 | 198 | 199 |
200 | 201 |

§§§

202 | 203 | 204 | 205 | 206 |
207 | 208 |

209 | Note: The following is an image that is set to 50% of the text width:
210 | picture 211 |

212 | 213 |
214 |
215 | 216 |

217 | picture 218 |

219 | 220 |
221 |
222 | 223 |

224 | picture 225 |

226 | 227 |
228 |
229 | 230 | 231 | 232 | -------------------------------------------------------------------------------- /examples/assets/text-render-sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test 6 | 7 | 114 | 115 | 116 | 117 | 118 | 119 |

À TextRender Example

120 | 121 |

122 | This is a sample HTML file for corona-textrender. 123 |

124 | 125 | 126 | 127 | This text does not have <p></p> wrapped around it.
128 | One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 129 |
130 | 131 |

132 | One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 133 |

134 | 135 |
136 |
137 |

138 | Yes, we can handle font-size: x-large; and the other relational font sizings. 139 |

140 | 141 | 142 |
143 | 144 |

145 | Hyperlinks appear HTML blue unless you specify your own color. You can also specify a background color instead of changing the text color for the hyperlink. Remember, hyperlinks execute functions you provide!

146 |

147 | This hyperlink opens up a Google search page using funx.popupWebpage(), a script to show web pages in the funx.lua module. 148 |

149 |
150 | 151 |

Unordered List:

152 | 157 | 158 |
159 | 160 |

Ordered List:

161 |

162 | (Clearly, nesting lists don't work quite right!) 163 |

164 |
    165 |
  1. One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species.
  2. 166 |
  3. Sub-List:
  4. 167 |
      168 |
    1. sub-item 1
    2. 169 |
    3. sub-item 2
    4. 170 |
    171 |
  5. Item 3
  6. 172 |
  7. This item is #10 by setting the 'value' attribute
  8. 173 |
  9. Another item
  10. 174 |
175 | 176 |
177 | 178 | 179 |

180 | Left-Indent Style: One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 181 |

182 | 183 |

184 | Left Style: One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 185 |

186 | 187 |

188 | Right Style: One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 189 |

190 | 191 |

192 | Center Style: One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 193 |

194 |
195 | 196 |
197 | The following text is not surrounded by <p>
198 | One of the most fantastic and most distinguishing features of this species is the bold dark-bars draped across the dorsal surface. Additional dark spots are found along the lateral surfaces of the species. 199 | 200 |
201 | 202 |

203 | Here is an example of the <sup> and <sub> tags. Note the extra spaces so the super/subscripts don't crowd each other. 204 |
205 |
206 | 2 + 2 2 3 - x n i= 6 207 |

208 | 209 | 210 |
211 | 212 |

§§§

213 | 214 | 215 | 216 | 217 |
218 | 219 |

220 | Note: The following is an image that is set to 50% of the text width:
221 | picture 222 |

223 | 224 |
225 |
226 | 227 |

228 | picture 229 |

230 | 231 |
232 |
233 | 234 |

235 | picture 236 |

237 | 238 |
239 |
240 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /examples/assets/textstyles.txt: -------------------------------------------------------------------------------- 1 | # SAMPLE TEXT STYLES FOR CORONA GRAPHICS v2 (values between 0-1) 2 | 3 | # style = font, size, leading, R,G,B, width, opacity, NORMAL|ALL_CAPS, text alignment, spaceBefore, spaceAfter, firstLineIndent, leftIndent, rightIndent 4 | 5 | # default paragraph style 6 | body = Avenir-Roman ,16,20,0,0,0,,100%, none, left,0,0,0,0,0 7 | 8 | # common styles 9 | Heading = Avenir-Black,16,20,0,0,0,,100%,,left,0,0,0,0,0 10 | Title=Avenir-Black,24,32,0.5,0.5,0.5,,100%,,left,10,0,0,0,0 11 | 12 | H1=Avenir-Black ,24,26,0,0,0,,100%,,left,12,24,0,0,0 13 | H2=Avenir-Black ,20,26,0,0,0,,100%,,left,12,12,0,0,0 14 | H3=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 15 | H4=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 16 | H6=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 17 | H5=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 18 | 19 | Quote = Avenir-Roman ,20,28,200,255,20,,100% 20 | 21 | hr = ,,,,,,,,, left,2,2,0,0,0 22 | 23 | # Default settings for hanging text in lists 24 | li = ,12,,,,,,,, left,0,0,-30,30,0 25 | ol = ,,,,,,,,, left,0,0,0,0,0 26 | 27 | 28 | # testing styles 29 | LeftIndent = Baskerville,16,24, 0,0,0,,100%, NORMAL, left,0,0,30,0,0 30 | Left = Baskerville,16,24, 0,0,0,,100%, NORMAL,left,0,0,0,0,0 31 | Right = Baskerville,16,24, 0,0,0,,100%, NORMAL,right,0,0,0,0,0 32 | Center = Baskerville,16,24, 0,0,0,,100%, NORMAL,center,0,0,0,0,0 33 | -------------------------------------------------------------------------------- /examples/build.settings: -------------------------------------------------------------------------------- 1 | settings = 2 | { 3 | orientation = 4 | { 5 | default = "PortraitLeft", 6 | supported = 7 | { 8 | "portraitLeft", "portraitRight" 9 | }, 10 | }, 11 | 12 | plugins = 13 | { 14 | --key is the name passed to Lua's 'require()' 15 | ["CoronaProvider.native.popup.social"] = 16 | { 17 | --required 18 | publisherId = "com.coronalabs", 19 | }, 20 | }, 21 | 22 | iphone = { 23 | plist = { 24 | UIAppFonts = 25 | { 26 | "LoveYaLikeASisterSolid.ttf", 27 | "NothingYouCouldSay.ttf", 28 | }, 29 | UIInterfaceOrientation = "UIInterfaceOrientationLandscapeRight", 30 | UISupportedInterfaceOrientations = 31 | { 32 | "UIInterfaceOrientationLandscapeLeft", 33 | "UIInterfaceOrientationLandscapeRight" 34 | }, 35 | 36 | CoronaUseIOS7IPadPhotoPickerLandscapeOnlyWorkaround = true, 37 | CoronaUseIOS6IPadPhotoPickerLandscapeOnlyWorkaround = true, 38 | CoronaUseIOS7LandscapeOnlyWorkaround = true, 39 | CoronaUseIOS6LandscapeOnlyWorkaround = true, 40 | 41 | UIPrerenderedIcon=true, 42 | UIStatusBarHidden=true, 43 | CFBundleDisplayName="Inside-Outside", 44 | UIApplicationExitsOnSuspend = false, 45 | 46 | FacebookAppID = "", 47 | CFBundleURLTypes = 48 | { 49 | { 50 | CFBundleURLSchemes = 51 | { 52 | "", 53 | } 54 | } 55 | }, 56 | CFBundleIconFile = "Icon.png", 57 | CFBundleIconFiles = { 58 | "Icon-72.png", 59 | "Icon-72@2x.png", 60 | "Icon-76.png", 61 | "Icon-76@2x.png", 62 | "Icon-120.png", 63 | "Icon-iPad-Spotlight-iOS7@2x.png", 64 | "Icon-Small-50.png", 65 | "Icon-Small.png", 66 | "Icon-Small@2x.png", 67 | "Icon-Spotlight-iOS7.png", 68 | "Icon-Spotlight-iOS7@2x.png", 69 | "Icon.png", 70 | "Icon@2x.png", 71 | }, 72 | }, 73 | }, 74 | 75 | 76 | android = 77 | { 78 | usesPermissions = 79 | { 80 | "android.permission.INTERNET", 81 | "android.permission.WRITE_EXTERNAL_STORAGE", 82 | }, 83 | }, 84 | 85 | 86 | } 87 | 88 | settings.iphone.plist["UIInterfaceOrientation~ipad"] = "UIInterfaceOrientationLandscapeLeft" 89 | settings.iphone.plist["UISupportedInterfaceOrientations~ipad"] = 90 | { 91 | "UIInterfaceOrientationLandscapeLeft", 92 | "UIInterfaceOrientationLandscapeRight" 93 | } 94 | -------------------------------------------------------------------------------- /examples/config.lua: -------------------------------------------------------------------------------- 1 | -- config.lua 2 | application = 3 | { 4 | content = 5 | { 6 | width = 768, 7 | height = 1024, 8 | scale = "letterbox", 9 | antialias = false, 10 | xAlign = "center", 11 | yAlign = "center", 12 | 13 | imageSuffix = 14 | { 15 | ["@0-5"] = 0.5, -- for smaller devices 16 | ["@2x"] = 2, -- for iPad 3 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/main.lua: -------------------------------------------------------------------------------- 1 | -- TextRender example 2 | -- 3 | -- Shows use of the textrender widget 4 | -- 5 | -- Sample code is MIT licensed, the same license which covers Lua itself 6 | -- http://en.wikipedia.org/wiki/MIT_License 7 | -- Copyright (C) 2015 David Gross. 8 | -- Copyright (C) 2014 David McCuskey. 9 | --====================================================================-- 10 | --[[ 11 | Permission is hereby granted, free of charge, to any person obtaining a copy of 12 | this software and associated documentation files (the "Software"), to deal in the 13 | Software without restriction, including without limitation the rights to use, copy, 14 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 15 | and to permit persons to whom the Software is furnished to do so, subject to the 16 | following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in all copies 19 | or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 22 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 23 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 24 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 25 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 | DEALINGS IN THE SOFTWARE. 27 | --]] 28 | 29 | 30 | 31 | 32 | --[[ 33 | Demonstration of textrender.lua, a module for rendering styled text. 34 | 35 | 36 | textrender parameters: 37 | 38 | text = text to render 39 | font = font name, e.g. "AvenirNext-DemiBoldItalic" 40 | size = font size in pixels 41 | lineHeight = line height in pixels 42 | color = text color in an RGBa color table, e.g. {250, 0, 0, 255} 43 | width = Width of the text column, 44 | alignment = text alignment: "Left", "Right", "Center" 45 | opacity = text opacity (between 0 and 1, or as a percent, e.g. "50%" or 0.5 46 | minCharCount = Minimum number of characters per line. Estimate low, e.g. 5 47 | targetDeviceScreenSize = String of target screen size, in the form, "width,height", e.g. e.g. "1024,768". May be different from current screen size. 48 | letterspacing = (unused) 49 | maxHeight = Maximum height of the text column. Extra text will be hidden. 50 | minWordLen = Minimum length of a word shown at the end of a line. In good typesetting, we don't end our lines with single letter words like "a", so normally this value is 2. 51 | textstyles = A table of text styles, loaded using funx.loadTextStyles() 52 | defaultStyle = The name of the default text style for the text block 53 | cacheDir = the name of the cache folder to use inside system.CachesDirectory, e.g. "text_render_cache" 54 | --]] 55 | 56 | 57 | -- Run test for cache speed by drawing/redrawing 58 | local testCacheSpeed = false 59 | 60 | -- My useful function collection 61 | local funx = require("scripts.funx") 62 | 63 | local textrender = require("scripts.textrender.textrender") 64 | 65 | -- Make a local copy of the application settings global 66 | local screenW, screenH = display.contentWidth, display.contentHeight 67 | local viewableScreenW, viewableScreenH = display.viewableContentWidth, display.viewableContentHeight 68 | local screenOffsetW, screenOffsetH = display.contentWidth - display.viewableContentWidth, display.contentHeight - display.viewableContentHeight 69 | local midscreenX = screenW*(0.5) 70 | local midscreenY = screenH*(0.5) 71 | 72 | local textStyles = funx.loadTextStyles("assets/textstyles.txt", system.ResourceDirectory) 73 | 74 | local mytext = funx.readFile("assets/text-render-sample.html") 75 | 76 | -- To cache using files, set the cache directory 77 | -- Not recommended, as it is slower than using SQLite 78 | local cacheDir = "textrender_cache" 79 | funx.mkdir (cacheDir, "",false, system.CachesDirectory) 80 | 81 | local navbarHeight = 50 82 | 83 | --===================================================================-- 84 | -- Page background 85 | --===================================================================-- 86 | local bkgd = display.newRect(0,0,screenW, screenH) 87 | bkgd:setFillColor(.9,.9,.9) 88 | funx.anchor(bkgd,"TopLeftReferencePoint") 89 | bkgd.x = 0 90 | bkgd.y = 0 91 | bkgd.strokeWidth = 0 92 | bkgd:setStrokeColor(.2, .2, .2, 1) 93 | 94 | 95 | --===================================================================-- 96 | -- Build a scrolling text field. 97 | --===================================================================-- 98 | 99 | local width, height = display.contentWidth * .8, (display.contentHeight * .8) - 40 100 | local x,y = 20, (display.contentHeight - height)/2 101 | 102 | --===================================================================-- 103 | -- Background Rectangle 104 | local strokeWidth = 1 105 | local padding = 0 106 | local textblockBkgd = display.newRect(x - strokeWidth - padding , y - strokeWidth - padding, width + strokeWidth + 2*padding, height + strokeWidth + 2*padding) 107 | textblockBkgd:setFillColor( 1,1,1 ) 108 | funx.anchor(textblockBkgd,"TopLeftReferencePoint") 109 | textblockBkgd.x = x - padding 110 | textblockBkgd.y = y - padding 111 | textblockBkgd.strokeWidth = strokeWidth 112 | textblockBkgd:setStrokeColor( 0,0,0,0.3) 113 | 114 | --===================================================================-- 115 | textrender.clearAllCaches(cacheDir) 116 | 117 | 118 | local msgblock = display.newGroup() 119 | msgblock.x = x - padding 120 | msgblock.y = y - 40 121 | 122 | local function removeMsgBlock() 123 | if (msgblock) then 124 | msgblock:removeSelf() 125 | msgblock = nil 126 | end 127 | end 128 | 129 | local function hyperlinkdemo( e ) 130 | 131 | local mytext = "

A hyperlink was tapped! The text is “" .. e.target._attr.text .. "”

" 132 | 133 | local params = { 134 | text = mytext, --loaded above 135 | width = width, 136 | maxHeight = 0, -- Set to zero, otherwise rendering STOPS after this amount! 137 | isHTML = true, 138 | } 139 | 140 | -- Clear existing message block 141 | removeMsgBlock() 142 | -- Create the message 143 | msgblock = textrender.autoWrappedText(params) 144 | msgblock.x = x - padding 145 | msgblock.y = y - 40 146 | 147 | timer.performWithDelay( 3000, removeMsgBlock ) 148 | end 149 | 150 | local function hyperlinkdemo2( e ) 151 | local targetURL = "https://www.google.com" 152 | funx.popupWebpage(targetURL) 153 | end 154 | 155 | 156 | --===================================================================-- 157 | -- Text Field 158 | local params = { 159 | text = mytext, --loaded above 160 | 161 | width = width, 162 | maxHeight = 0, -- Set to zero, otherwise rendering STOPS after this amount! 163 | 164 | isHTML = true, 165 | useHTMLSpacing = true, 166 | 167 | textstyles = textStyles, 168 | 169 | -- Not needed, but defaults 170 | font = "AvenirNext-Regular", 171 | size = "12", 172 | lineHeight = "16", 173 | color = {0, 0, 0, 255}, 174 | alignment = "Left", 175 | opacity = "100%", 176 | letterspacing = 0, 177 | defaultStyle = "Normal", 178 | 179 | -- The higher these are, the faster a row is wrapped 180 | minCharCount = 10, -- Minimum number of characters per line. Start low. Default is 5 181 | minWordLen = 2, 182 | 183 | -- not necessary, might not even work 184 | targetDeviceScreenSize = screenW..","..screenH, -- Target screen size, may be different from current screen size 185 | 186 | -- The handler is the function executed when a hyperlink is tapped. 187 | -- It will get the HREF from the tag. 188 | handler = hyperlinkdemo2, 189 | 190 | -- cacheDir is empty so we do not use caching with files, instead we use the SQLite database 191 | -- which is faster. 192 | cacheDir = nil, 193 | cacheToDB = true, -- true is default, for fast caches using sql database 194 | } 195 | 196 | local textblock = textrender.autoWrappedText(params) 197 | 198 | 199 | 200 | --===================================================================-- 201 | -- Make the textblock a scrolling text block 202 | local options = { 203 | maxVisibleHeight = height, 204 | parentTouchObject = nil, 205 | 206 | hideBackground = true, 207 | backgroundColor = {1,1,1}, -- hidden by the above line 208 | 209 | -- Show an icon over scrolling fields: values are "over", "bottom", anything else otherwise defaults to top+bottom 210 | scrollingFieldIndicatorActive = true, 211 | -- "over", "bottom", else top and bottom 212 | scrollingFieldIndicatorLocation = "", 213 | -- image files 214 | scrollingFieldIndicatorIconOver = "scripts/textrender/assets/scrolling-indicator-1024.png", 215 | scrollingFieldIndicatorIconDown = "scripts/textrender/assets/scrollingfieldindicatoricon-down.png", 216 | scrollingFieldIndicatorIconUp = "scripts/textrender/assets/scrollingfieldindicatoricon-up.png", 217 | pageItemsFadeOutOpeningTime = 300, 218 | pageItemsFadeInOpeningTime = 500, 219 | pageItemsPrefadeOnOpeningTime = 500, 220 | 221 | } 222 | 223 | local textblock = textblock:fitBlockToHeight( options ) 224 | local yAdjustment = textblock.yAdjustment 225 | textblock.x = x 226 | textblock.y = y + yAdjustment 227 | 228 | if (testCacheSpeed) then 229 | -- Remove for testing below, but now it is cached 230 | textblock:removeSelf() 231 | 232 | local startTime = system.getTimer() 233 | local doCache = true 234 | local n = 10 235 | print ("Repeat textrender for "..n.." times.") 236 | if (doCache) then 237 | print ("( using Caching )") 238 | end 239 | 240 | for i = 1, n do 241 | 242 | print ("textrender #"..i ) 243 | 244 | -- Build 245 | params.cacheToDB = doCache 246 | textblock = textrender.autoWrappedText(params) 247 | 248 | local textblock = textblock:fitBlockToHeight( options ) 249 | local yAdjustment = textblock.yAdjustment 250 | textblock.x = x 251 | textblock.y = y 252 | 253 | -- Remove 254 | textblock:removeSelf() 255 | 256 | if (not doCache) then 257 | print ("Clear caches.") 258 | textrender.clearAllCaches(cacheDir) 259 | end 260 | 261 | end 262 | local totalTime = math.floor((system.getTimer() - startTime) * 100) / 100 263 | print ("Time for "..n.." repetitions: ".. totalTime .. " milliseconds, average speed is " .. totalTime/n .. " milliseconds") 264 | 265 | 266 | textblock = textrender.autoWrappedText(params) 267 | 268 | local textblock = textblock:fitBlockToHeight( options ) 269 | local yAdjustment = textblock.yAdjustment 270 | textblock.x = x 271 | textblock.y = y 272 | end -- test cache speed 273 | 274 | --===================================================================-- 275 | -- Testing buttons 276 | 277 | local buttonX = screenW - 120 278 | local buttonY = 60 279 | 280 | 281 | local wf = false 282 | local function toggleWireframe() 283 | wf = not wf 284 | display.setDrawMode( "wireframe", wf ) 285 | if (not wf) then 286 | display.setDrawMode( "forceRender" ) 287 | end 288 | print ("WF = ",wf) 289 | end 290 | 291 | local widget = require ("widget") 292 | local wfb = widget.newButton{ 293 | label = "Wireframe", 294 | labelColor = { default={ 0,0,0 }, over={ 1, 0, 0, 0.5 } }, 295 | fontSize = 20, 296 | x =buttonX, 297 | y=buttonY, 298 | shape = "roundedRect", 299 | fillColor = { default={ .7,.7,.7 }, over={ .2, .2, .2 } }, 300 | onRelease = toggleWireframe, 301 | } 302 | wfb:toFront() 303 | -------------------------------------------------------------------------------- /examples/scripts/funx/popup-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/funx/popup-black.png -------------------------------------------------------------------------------- /examples/scripts/funx/popup-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/funx/popup-white.png -------------------------------------------------------------------------------- /examples/scripts/funx/spinner.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- created with TexturePacker (http://www.codeandweb.com/texturepacker) 3 | -- 4 | -- $TexturePacker:SmartUpdate:459fc7091d0a2612fe2f6ac2521fece9:796598a08e961b575f09566039a37861:7f3c883f0651180a344ed5c6ae525a42$ 5 | -- 6 | -- local sheetInfo = require("mysheet") 7 | -- local myImageSheet = graphics.newImageSheet( "mysheet.png", sheetInfo:getSheet() ) 8 | -- local sprite = display.newSprite( myImageSheet , {frames={sheetInfo:getFrameIndex("sprite")}} ) 9 | -- 10 | 11 | local SheetInfo = {} 12 | 13 | SheetInfo.sheet = 14 | { 15 | frames = { 16 | 17 | { 18 | -- spinner-18 19 | x=2, 20 | y=2, 21 | width=372, 22 | height=367, 23 | 24 | sourceX = 6, 25 | sourceY = 6, 26 | sourceWidth = 384, 27 | sourceHeight = 379 28 | }, 29 | { 30 | -- spinner-17 31 | x=376, 32 | y=2, 33 | width=372, 34 | height=367, 35 | 36 | sourceX = 6, 37 | sourceY = 6, 38 | sourceWidth = 384, 39 | sourceHeight = 379 40 | }, 41 | { 42 | -- spinner-16 43 | x=750, 44 | y=2, 45 | width=372, 46 | height=367, 47 | 48 | sourceX = 6, 49 | sourceY = 6, 50 | sourceWidth = 384, 51 | sourceHeight = 379 52 | }, 53 | { 54 | -- spinner-15 55 | x=1124, 56 | y=2, 57 | width=372, 58 | height=367, 59 | 60 | sourceX = 6, 61 | sourceY = 6, 62 | sourceWidth = 384, 63 | sourceHeight = 379 64 | }, 65 | { 66 | -- spinner-14 67 | x=2, 68 | y=371, 69 | width=372, 70 | height=367, 71 | 72 | sourceX = 6, 73 | sourceY = 6, 74 | sourceWidth = 384, 75 | sourceHeight = 379 76 | }, 77 | { 78 | -- spinner-13 79 | x=376, 80 | y=371, 81 | width=372, 82 | height=367, 83 | 84 | sourceX = 6, 85 | sourceY = 6, 86 | sourceWidth = 384, 87 | sourceHeight = 379 88 | }, 89 | { 90 | -- spinner-12 91 | x=750, 92 | y=371, 93 | width=372, 94 | height=367, 95 | 96 | sourceX = 6, 97 | sourceY = 6, 98 | sourceWidth = 384, 99 | sourceHeight = 379 100 | }, 101 | { 102 | -- spinner-11 103 | x=1124, 104 | y=371, 105 | width=372, 106 | height=367, 107 | 108 | sourceX = 6, 109 | sourceY = 6, 110 | sourceWidth = 384, 111 | sourceHeight = 379 112 | }, 113 | { 114 | -- spinner-10 115 | x=2, 116 | y=740, 117 | width=372, 118 | height=367, 119 | 120 | sourceX = 6, 121 | sourceY = 6, 122 | sourceWidth = 384, 123 | sourceHeight = 379 124 | }, 125 | { 126 | -- spinner-9 127 | x=376, 128 | y=740, 129 | width=372, 130 | height=367, 131 | 132 | sourceX = 6, 133 | sourceY = 6, 134 | sourceWidth = 384, 135 | sourceHeight = 379 136 | }, 137 | { 138 | -- spinner-8 139 | x=750, 140 | y=740, 141 | width=372, 142 | height=367, 143 | 144 | sourceX = 6, 145 | sourceY = 6, 146 | sourceWidth = 384, 147 | sourceHeight = 379 148 | }, 149 | { 150 | -- spinner-7 151 | x=1124, 152 | y=740, 153 | width=372, 154 | height=367, 155 | 156 | sourceX = 6, 157 | sourceY = 6, 158 | sourceWidth = 384, 159 | sourceHeight = 379 160 | }, 161 | { 162 | -- spinner-6 163 | x=2, 164 | y=1109, 165 | width=372, 166 | height=367, 167 | 168 | sourceX = 6, 169 | sourceY = 6, 170 | sourceWidth = 384, 171 | sourceHeight = 379 172 | }, 173 | { 174 | -- spinner-5 175 | x=376, 176 | y=1109, 177 | width=372, 178 | height=367, 179 | 180 | sourceX = 6, 181 | sourceY = 6, 182 | sourceWidth = 384, 183 | sourceHeight = 379 184 | }, 185 | { 186 | -- spinner-4 187 | x=750, 188 | y=1109, 189 | width=372, 190 | height=367, 191 | 192 | sourceX = 6, 193 | sourceY = 6, 194 | sourceWidth = 384, 195 | sourceHeight = 379 196 | }, 197 | { 198 | -- spinner-3 199 | x=1124, 200 | y=1109, 201 | width=372, 202 | height=367, 203 | 204 | sourceX = 6, 205 | sourceY = 6, 206 | sourceWidth = 384, 207 | sourceHeight = 379 208 | }, 209 | { 210 | -- spinner-2 211 | x=2, 212 | y=1478, 213 | width=372, 214 | height=367, 215 | 216 | sourceX = 6, 217 | sourceY = 6, 218 | sourceWidth = 384, 219 | sourceHeight = 379 220 | }, 221 | { 222 | -- spinner-1 223 | x=376, 224 | y=1478, 225 | width=372, 226 | height=367, 227 | 228 | sourceX = 6, 229 | sourceY = 6, 230 | sourceWidth = 384, 231 | sourceHeight = 379 232 | }, 233 | }, 234 | 235 | sheetContentWidth = 1498, 236 | sheetContentHeight = 1847 237 | } 238 | 239 | SheetInfo.sequenceData = 240 | { 241 | name = "spinner", 242 | start = 1, 243 | count = 18, 244 | time = 2000, 245 | 246 | } 247 | 248 | function SheetInfo:getSheet() 249 | return self.sheet; 250 | end 251 | 252 | return SheetInfo 253 | -------------------------------------------------------------------------------- /examples/scripts/funx/spinner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/funx/spinner.png -------------------------------------------------------------------------------- /examples/scripts/textrender/README.md: -------------------------------------------------------------------------------- 1 | corona-textrender 2 | ====================== 3 | 4 | ## Synopsis 5 | 6 | A pure-Lua text rendering module for Corona SDK which can handle basic HTML, fonts, font-styles, and even basic font metrics. 7 | 8 | 9 | ## Options 10 | The function uses a table with options. 11 | 12 | text : [string] The text to render. It can be HTML or unstyled text. 13 | 14 | width : [number] width of the column of text in pixels 15 | 16 | maxHeight : [number] Maximum height of the text block. Extra text is not rendered. 17 | 18 | isHTML : [boolean] Set to true if the text is simplified HTML styled text. Default is true. 19 | 20 | useHTMLSpacing : [boolean] Set to true to change all returns and tabs and double-spaces to a single space, as with HTML in a browser. Default is true. 21 | 22 | testing = false, -- [boolean] True for testing, shows borders and colors. 23 | 24 | 25 | ### Font Defaults 26 | 27 | font : [string] The iOS or Android font name, e.g. "AvenirNext-Regular". Don't use Postscript names, they won't work. See http://iosfonts.com for a list of built-in iOS fonts. 28 | 29 | size : [number] The default font size. Changed by any style settings in the text. 30 | 31 | lineHeight : [number] The default line height. Changed by any style settings in the text. 32 | 33 | color : [table] The default font color. Changed by any style settings in the text. Use an RGBa table, like this: {0, 0, 0, 1} (black type) 34 | 35 | opacity : [number] The default font opacity (or alpha). Changed by any style settings in the text. Use a number, e.g. 0.3 or a percentage in a string, e.g. "80%" 36 | 37 | alignment : [number] Default text alignment, note the initial capital letter. "Left" | "Right" | "Center" 38 | 39 | ### Caching Settings 40 | This module caches the text rendering so that the second time you show the text, it appears much faster. It uses some heuristics (i.e. guesses) for speed. You don't have to set any of this. You can just use the defaults. 41 | 42 | minCharCount : [number] Minimum number of characters per line. Start low, like 5. 43 | 44 | cacheToDB : [boolean] Default is true. Set to false for no caching. Uses sqlite3 caching (faster). 45 | 46 | cacheDir : [string] If cacheToDB is false, then try this method for caching. If this value is set to the _full path_ to the cache directory to use for json file caching (slower). 47 | 48 | 49 | minWordLen : [number] 2, - Minimum length of a word shown at the end of a line, e.g. don't end lines with "a". 50 | 51 | ### Text Style Sheets 52 | 53 | textstyles : [table] The styles table. Load the table using using funx.loadTextStyles 54 | 55 | defaultStyle : [sring] The name of the the default style (from textstyles.txt) for text, default is "Normal". 56 | 57 | 58 | ### Hyperlinks 59 | 60 | handler : [function] A function that will accept a 'tap' event on a hyperlink. 61 | 62 | hyperlinkFillColor : [string] The fill of a box surrounding a hyperlink.An RGBa color in a string, like this: "200,120,255,100". Note, this value must be set in your code...there is no textstyle for it. 63 | 64 | hyperlinkTextColor : [string] The color of text of hyperlink. An RGBa color in a string, like this: "200,120,255,100" 65 | 66 | You can also set the hyperlink text color by creating an "a" tag in the textstyles.txt document. Hyperlinks use the HTML "a" tag (like a "p" or "ol"), so that style will be applied. 67 | 68 | 69 | ### Unused or In Development 70 | Here are some options that I started work on but never finished or found no current use for. 71 | 72 | ~~targetDeviceScreenSize : [string] The screen dimensions as "width,height", e.g. "1024,768" This is the target screen size, used to resize text to be readable on different screens~~ 73 | 74 | ~~letterspacing : [number] Letterspacing in pixels. (PLANNED, NOT IN USE)~~ 75 | 76 | 77 | 78 | 79 | ## Code Example 80 | 81 | ``` 82 | -- Load the module 83 | local funx = require("scripts.funx") 84 | local textrender = require("scripts.textrender.textrender") 85 | local textStyles = funx.loadTextStyles("scripts/textrender/textstyles.txt", system.ResourceDirectory) 86 | 87 | ------------ 88 | -- For TESTING, we clear text caches so we can see changes to our code and texts. 89 | -- We clear the cache before begining, so first render creates a cache, second uses it. 90 | textrender.clearAllCaches(cacheDir) 91 | 92 | ------------ 93 | -- Sample text 94 | local mytext = [[ 95 |

96 | Hit events propagate until they are handled. This means that if you have multiple objects overlaying each other in the display hierarchy, and a hit event listener has been applied to each, the hit event will propagate through all of these objects. 97 |

98 |

99 | Hit events propagate until they are handled. This means that if you have multiple objects overlaying each other in the display hierarchy, and a hit event listener has been applied to each, the hit event will propagate through all of these objects. 100 |

101 | ]] 102 | 103 | local options = { 104 | text = mytext, 105 | font = "AvenirNext-Regular", 106 | size = "12", 107 | lineHeight = "16", 108 | color = {0, 0, 0, 255}, 109 | opacity = "100%", 110 | width = w, -- width of the column of text 111 | alignment = "Left", -- default text alignment, note the initial capital letter 112 | minCharCount = 5, -- Minimum number of characters per line. Start low. 113 | targetDeviceScreenSize = screenW..","..screenH, -- Target screen size, may be different from current screen size 114 | letterspacing = 0, 115 | maxHeight = screenH - 50, 116 | minWordLen = 2, - Minimum length of a word shown at the end of a line, e.g. don't end lines with "a". 117 | textstyles = textStyles, -- styles table, loaded using funx.loadTextStyles 118 | defaultStyle = "Normal", -- default style (from textstyles.txt) for text 119 | cacheToDB = true, -- default is true, set to false for no caching, uses sqlite3 caching (faster) 120 | cacheDir = nil, -- Set to cache directory name to use json file caching (slow) 121 | handler = handler, -- a function that will accept a 'tap' event 122 | hyperlinkFillColor = hyperlinkFillColor, -- an RGBa color in a string, like this: "200,120,255,100" 123 | hyperlinkTextColor = hyperlinkTextColor, -- an RGBa color in a string, like this: "200,120,255,100" 124 | isHTML = true, -- TRUE if the text is simplified HTML styled text 125 | useHTMLSpacing = true, -- if TRUE, then change all returns and tabs and double-spaces to a single space 126 | testing = false, -- [boolean] True for testing, shows borders and colors. 127 | } 128 | local textblock = textwrap.autoWrappedText( options ) 129 | ``` 130 | 131 | 132 | ## Style Sheets 133 | The module uses style sheets of predefined styles. It does render many HTML attributes, such as color and fontsize, so a great deal of HTML will work without change. 134 | 135 | You load the style sheet before calling the textrender() function. This way, you only need to load it once, and that's faster. 136 | 137 | A stylesheet is a simple format. Each style is a line, beginning with a name, like this: 138 | 139 | style = font, size, leading, R,G,B, width, opacity, NORMAL|ALL_CAPS, text alignment, spaceBefore, spaceAfter, firstLineIndent, leftIndent, rightIndent 140 | 141 | Use a '#' to comment a line. 142 | 143 | Here is an example (note the colors use the 2.0 version of Corona with values between 0 and 1): 144 | ``` 145 | # TEXT STYLES FOR CORONA GRAPHICS v2 (values between 0-1) 146 | 147 | # style = font, size, leading, R,G,B, width, opacity, NORMAL|ALL_CAPS, text alignment, spaceBefore, spaceAfter, firstLineIndent, leftIndent, rightIndent 148 | 149 | #generic styles 150 | Normal = Avenir-Book,16,20,0,0,0,,100% 151 | Heading = Avenir-Bold,16,20,0,0,0,,100% 152 | Title=Avenir-Light,24,40,0.5,0.5,0.5,,100%,NORMAL,left,10,6,0,0,0 153 | H1=,18,26,0,0,0,,100%,NORMAL,left,12,4,0,0,0 154 | H2=Avenir-Book,18,26,0,0,0,,100%,NORMAL,left,12,4,0,0,0 155 | H2 Light=Avenir-Book,18,26,220,220,220,,100%,NORMAL,left,12,4,0,0,0 156 | H3=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 157 | H4=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 158 | H6=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 159 | H5=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 160 | Quote = Avenir-Light,20,28,200,255,20,,100% 161 | ``` 162 | 163 | ## HTML Tags 164 | The module recognizes the following HTML tags. 165 | - p 166 | ``

text

167 | - br 168 | - ol, li 169 | - b,i,em, strong 170 | - font 171 | - sup, sub 172 | - a 173 | - img 174 | 175 | 176 | ## Notes: 177 | 178 | ###Hyperlinking 179 | 180 | handler : a function that will use a 'tap' event. Note that event.target._attr contains the HTML attributes of the hyperlink, e.g. href, style, class, whatever your throw in. 181 | In the example, the function will get 'makeSound' as the href, and it can do the appropriate action. 182 | You can pass any attribute you need, such as a page number or URL, of course.
183 | Example: <a href="makeSound" style="font-size:24;">My Link</a> 184 | 185 | ###Parts of the module 186 | - textrender.lua : the module that renders a piece of text. The text can have basic HTML coding (p, br, i, em, b, li, ol), as well as my built-in paragraph formatting. It will also read the 'class' attribute of HTML to figure out the style, then apply the style from the textstyles.txt file! 187 | - HTML support: entities.lua, html.lua : these are open source modules I found and modified to handle HTML 188 | - fontmetrics.lua, fontmetrics.txt, fontvariations.txt : this module and files let the textwrap module position type correctly on the screen. Normally, you can't position with baseline, but these modules let us do that. 189 | - funx.lua : a large collection of useful functions 190 | 191 | 192 | ## Motivation 193 | 194 | Corona SDK does not offer styled text, and this code makes it easy to take existing HTML text and use it. 195 | Also, Corona SDK does not position text using font metrics. Therefore it is very hard to write code that will show text as it appears in layout programs. 196 | 197 | ## Installation 198 | 199 | In your main Corona app folder, create a folder named "scripts". From the "scripts" folder in this repo, copy these folders to your scripts folder. 200 | * funx.lua 201 | * textrender 202 | 203 | Your app folder should now look something like this: 204 | * main folder 205 | * main.lua (your main file) 206 | * scripts 207 | * funx.lua 208 | * textrender 209 | 210 | 211 | ## Tests 212 | 213 | NA 214 | ## Contributors 215 | 216 | This was created by me! 217 | 218 | ## License 219 | 220 | The MIT License (MIT) 221 | 222 | Copyright (c) 2015 David Gross 223 | 224 | Permission is hereby granted, free of charge, to any person obtaining a copy 225 | of this software and associated documentation files (the "Software"), to deal 226 | in the Software without restriction, including without limitation the rights 227 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 228 | copies of the Software, and to permit persons to whom the Software is 229 | furnished to do so, subject to the following conditions: 230 | 231 | The above copyright notice and this permission notice shall be included in all 232 | copies or substantial portions of the Software. 233 | 234 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 235 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 236 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 237 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 238 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 239 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 240 | SOFTWARE. 241 | -------------------------------------------------------------------------------- /examples/scripts/textrender/assets/scrolling-indicator-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/textrender/assets/scrolling-indicator-1024.png -------------------------------------------------------------------------------- /examples/scripts/textrender/assets/scrolling-indicator-1024.png.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/textrender/assets/scrolling-indicator-1024.png.txt -------------------------------------------------------------------------------- /examples/scripts/textrender/assets/scrollingfieldindicatoricon-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/textrender/assets/scrollingfieldindicatoricon-down.png -------------------------------------------------------------------------------- /examples/scripts/textrender/assets/scrollingfieldindicatoricon-down.png.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/textrender/assets/scrollingfieldindicatoricon-down.png.txt -------------------------------------------------------------------------------- /examples/scripts/textrender/assets/scrollingfieldindicatoricon-down@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/textrender/assets/scrollingfieldindicatoricon-down@2x.png -------------------------------------------------------------------------------- /examples/scripts/textrender/assets/scrollingfieldindicatoricon-down@2x.png.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/textrender/assets/scrollingfieldindicatoricon-down@2x.png.txt -------------------------------------------------------------------------------- /examples/scripts/textrender/assets/scrollingfieldindicatoricon-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/textrender/assets/scrollingfieldindicatoricon-up.png -------------------------------------------------------------------------------- /examples/scripts/textrender/assets/scrollingfieldindicatoricon-up.png.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/textrender/assets/scrollingfieldindicatoricon-up.png.txt -------------------------------------------------------------------------------- /examples/scripts/textrender/assets/scrollingfieldindicatoricon-up@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/textrender/assets/scrollingfieldindicatoricon-up@2x.png -------------------------------------------------------------------------------- /examples/scripts/textrender/assets/scrollingfieldindicatoricon-up@2x.png.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimetic/corona-textrender/8eb8ce1d0b9e05f5a065a36da0de4c0e3d6bf96d/examples/scripts/textrender/assets/scrollingfieldindicatoricon-up@2x.png.txt -------------------------------------------------------------------------------- /examples/scripts/textrender/entities.lua: -------------------------------------------------------------------------------- 1 | -- convert numeric html entities to utf8 2 | -- converts from stdin to stdout 3 | -- example: € -> € 4 | -- from http://www.hpelbers.org/lua/utf8 5 | 6 | --- Functions for dealing with HTML/XML entities. 7 | 8 | local M = {} 9 | 10 | 11 | local char = string.char 12 | 13 | local function tail(n, k) 14 | local u, r='' 15 | for i=1,k do 16 | n,r = math.floor(n/0x40), n%0x40 17 | u = char(r+0x80) .. u 18 | end 19 | return u, n 20 | end 21 | 22 | local function to_utf8(a) 23 | if not a then return nil end 24 | local n, r, u = tonumber(a) 25 | if n<0x80 then -- 1 byte 26 | return char(n) 27 | elseif n<0x800 then -- 2 byte 28 | u, n = tail(n, 1) 29 | return char(n+0xc0) .. u 30 | elseif n<0x10000 then -- 3 byte 31 | u, n = tail(n, 2) 32 | return char(n+0xe0) .. u 33 | elseif n<0x200000 then -- 4 byte 34 | u, n = tail(n, 3) 35 | return char(n+0xf0) .. u 36 | elseif n<0x4000000 then -- 5 byte 37 | u, n = tail(n, 4) 38 | return char(n+0xf8) .. u 39 | else -- 6 byte 40 | u, n = tail(n, 5) 41 | return char(n+0xfc) .. u 42 | end 43 | end 44 | 45 | 46 | local character_entities = { 47 | ["quot"] = 0x0022, 48 | ["amp"] = 0x0026, 49 | ["apos"] = 0x0027, 50 | ["lt"] = 0x003C, 51 | ["gt"] = 0x003E, 52 | ["nbsp"] = 160, 53 | ["iexcl"] = 0x00A1, 54 | ["cent"] = 0x00A2, 55 | ["pound"] = 0x00A3, 56 | ["curren"] = 0x00A4, 57 | ["yen"] = 0x00A5, 58 | ["brvbar"] = 0x00A6, 59 | ["sect"] = 0x00A7, 60 | ["uml"] = 0x00A8, 61 | ["copy"] = 0x00A9, 62 | ["ordf"] = 0x00AA, 63 | ["laquo"] = 0x00AB, 64 | ["not"] = 0x00AC, 65 | ["shy"] = 173, 66 | ["reg"] = 0x00AE, 67 | ["macr"] = 0x00AF, 68 | ["deg"] = 0x00B0, 69 | ["plusmn"] = 0x00B1, 70 | ["sup2"] = 0x00B2, 71 | ["sup3"] = 0x00B3, 72 | ["acute"] = 0x00B4, 73 | ["micro"] = 0x00B5, 74 | ["para"] = 0x00B6, 75 | ["middot"] = 0x00B7, 76 | ["cedil"] = 0x00B8, 77 | ["sup1"] = 0x00B9, 78 | ["ordm"] = 0x00BA, 79 | ["raquo"] = 0x00BB, 80 | ["frac14"] = 0x00BC, 81 | ["frac12"] = 0x00BD, 82 | ["frac34"] = 0x00BE, 83 | ["iquest"] = 0x00BF, 84 | ["Agrave"] = 0x00C0, 85 | ["Aacute"] = 0x00C1, 86 | ["Acirc"] = 0x00C2, 87 | ["Atilde"] = 0x00C3, 88 | ["Auml"] = 0x00C4, 89 | ["Aring"] = 0x00C5, 90 | ["AElig"] = 0x00C6, 91 | ["Ccedil"] = 0x00C7, 92 | ["Egrave"] = 0x00C8, 93 | ["Eacute"] = 0x00C9, 94 | ["Ecirc"] = 0x00CA, 95 | ["Euml"] = 0x00CB, 96 | ["Igrave"] = 0x00CC, 97 | ["Iacute"] = 0x00CD, 98 | ["Icirc"] = 0x00CE, 99 | ["Iuml"] = 0x00CF, 100 | ["ETH"] = 0x00D0, 101 | ["Ntilde"] = 0x00D1, 102 | ["Ograve"] = 0x00D2, 103 | ["Oacute"] = 0x00D3, 104 | ["Ocirc"] = 0x00D4, 105 | ["Otilde"] = 0x00D5, 106 | ["Ouml"] = 0x00D6, 107 | ["times"] = 0x00D7, 108 | ["Oslash"] = 0x00D8, 109 | ["Ugrave"] = 0x00D9, 110 | ["Uacute"] = 0x00DA, 111 | ["Ucirc"] = 0x00DB, 112 | ["Uuml"] = 0x00DC, 113 | ["Yacute"] = 0x00DD, 114 | ["THORN"] = 0x00DE, 115 | ["szlig"] = 0x00DF, 116 | ["agrave"] = 0x00E0, 117 | ["aacute"] = 0x00E1, 118 | ["acirc"] = 0x00E2, 119 | ["atilde"] = 0x00E3, 120 | ["auml"] = 0x00E4, 121 | ["aring"] = 0x00E5, 122 | ["aelig"] = 0x00E6, 123 | ["ccedil"] = 0x00E7, 124 | ["egrave"] = 0x00E8, 125 | ["eacute"] = 0x00E9, 126 | ["ecirc"] = 0x00EA, 127 | ["euml"] = 0x00EB, 128 | ["igrave"] = 0x00EC, 129 | ["iacute"] = 0x00ED, 130 | ["icirc"] = 0x00EE, 131 | ["iuml"] = 0x00EF, 132 | ["eth"] = 0x00F0, 133 | ["ntilde"] = 0x00F1, 134 | ["ograve"] = 0x00F2, 135 | ["oacute"] = 0x00F3, 136 | ["ocirc"] = 0x00F4, 137 | ["otilde"] = 0x00F5, 138 | ["ouml"] = 0x00F6, 139 | ["divide"] = 0x00F7, 140 | ["oslash"] = 0x00F8, 141 | ["ugrave"] = 0x00F9, 142 | ["uacute"] = 0x00FA, 143 | ["ucirc"] = 0x00FB, 144 | ["uuml"] = 0x00FC, 145 | ["yacute"] = 0x00FD, 146 | ["thorn"] = 0x00FE, 147 | ["yuml"] = 0x00FF, 148 | ["OElig"] = 0x0152, 149 | ["oelig"] = 0x0153, 150 | ["Scaron"] = 0x0160, 151 | ["scaron"] = 0x0161, 152 | ["Yuml"] = 0x0178, 153 | ["fnof"] = 0x0192, 154 | ["circ"] = 0x02C6, 155 | ["tilde"] = 0x02DC, 156 | ["Alpha"] = 0x0391, 157 | ["Beta"] = 0x0392, 158 | ["Gamma"] = 0x0393, 159 | ["Delta"] = 0x0394, 160 | ["Epsilon"] = 0x0395, 161 | ["Zeta"] = 0x0396, 162 | ["Eta"] = 0x0397, 163 | ["Theta"] = 0x0398, 164 | ["Iota"] = 0x0399, 165 | ["Kappa"] = 0x039A, 166 | ["Lambda"] = 0x039B, 167 | ["Mu"] = 0x039C, 168 | ["Nu"] = 0x039D, 169 | ["Xi"] = 0x039E, 170 | ["Omicron"] = 0x039F, 171 | ["Pi"] = 0x03A0, 172 | ["Rho"] = 0x03A1, 173 | ["Sigma"] = 0x03A3, 174 | ["Tau"] = 0x03A4, 175 | ["Upsilon"] = 0x03A5, 176 | ["Phi"] = 0x03A6, 177 | ["Chi"] = 0x03A7, 178 | ["Psi"] = 0x03A8, 179 | ["Omega"] = 0x03A9, 180 | ["alpha"] = 0x03B1, 181 | ["beta"] = 0x03B2, 182 | ["gamma"] = 0x03B3, 183 | ["delta"] = 0x03B4, 184 | ["epsilon"] = 0x03B5, 185 | ["zeta"] = 0x03B6, 186 | ["eta"] = 0x03B7, 187 | ["theta"] = 0x03B8, 188 | ["iota"] = 0x03B9, 189 | ["kappa"] = 0x03BA, 190 | ["lambda"] = 0x03BB, 191 | ["mu"] = 0x03BC, 192 | ["nu"] = 0x03BD, 193 | ["xi"] = 0x03BE, 194 | ["omicron"] = 0x03BF, 195 | ["pi"] = 0x03C0, 196 | ["rho"] = 0x03C1, 197 | ["sigmaf"] = 0x03C2, 198 | ["sigma"] = 0x03C3, 199 | ["tau"] = 0x03C4, 200 | ["upsilon"] = 0x03C5, 201 | ["phi"] = 0x03C6, 202 | ["chi"] = 0x03C7, 203 | ["psi"] = 0x03C8, 204 | ["omega"] = 0x03C9, 205 | ["thetasym"] = 0x03D1, 206 | ["upsih"] = 0x03D2, 207 | ["piv"] = 0x03D6, 208 | ["ensp"] = 0x2002, 209 | ["emsp"] = 0x2003, 210 | ["thinsp"] = 0x2009, 211 | ["ndash"] = 0x2013, 212 | ["mdash"] = 0x2014, 213 | ["lsquo"] = 0x2018, 214 | ["rsquo"] = 0x2019, 215 | ["sbquo"] = 0x201A, 216 | ["ldquo"] = 0x201C, 217 | ["rdquo"] = 0x201D, 218 | ["bdquo"] = 0x201E, 219 | ["dagger"] = 0x2020, 220 | ["Dagger"] = 0x2021, 221 | ["bull"] = 0x2022, 222 | ["hellip"] = 0x2026, 223 | ["permil"] = 0x2030, 224 | ["prime"] = 0x2032, 225 | ["Prime"] = 0x2033, 226 | ["lsaquo"] = 0x2039, 227 | ["rsaquo"] = 0x203A, 228 | ["oline"] = 0x203E, 229 | ["frasl"] = 0x2044, 230 | ["euro"] = 0x20AC, 231 | ["image"] = 0x2111, 232 | ["weierp"] = 0x2118, 233 | ["real"] = 0x211C, 234 | ["trade"] = 0x2122, 235 | ["alefsym"] = 0x2135, 236 | ["larr"] = 0x2190, 237 | ["uarr"] = 0x2191, 238 | ["rarr"] = 0x2192, 239 | ["darr"] = 0x2193, 240 | ["harr"] = 0x2194, 241 | ["crarr"] = 0x21B5, 242 | ["lArr"] = 0x21D0, 243 | ["uArr"] = 0x21D1, 244 | ["rArr"] = 0x21D2, 245 | ["dArr"] = 0x21D3, 246 | ["hArr"] = 0x21D4, 247 | ["forall"] = 0x2200, 248 | ["part"] = 0x2202, 249 | ["exist"] = 0x2203, 250 | ["empty"] = 0x2205, 251 | ["nabla"] = 0x2207, 252 | ["isin"] = 0x2208, 253 | ["notin"] = 0x2209, 254 | ["ni"] = 0x220B, 255 | ["prod"] = 0x220F, 256 | ["sum"] = 0x2211, 257 | ["minus"] = 0x2212, 258 | ["lowast"] = 0x2217, 259 | ["radic"] = 0x221A, 260 | ["prop"] = 0x221D, 261 | ["infin"] = 0x221E, 262 | ["ang"] = 0x2220, 263 | ["and"] = 0x2227, 264 | ["or"] = 0x2228, 265 | ["cap"] = 0x2229, 266 | ["cup"] = 0x222A, 267 | ["int"] = 0x222B, 268 | ["there4"] = 0x2234, 269 | ["sim"] = 0x223C, 270 | ["cong"] = 0x2245, 271 | ["asymp"] = 0x2248, 272 | ["ne"] = 0x2260, 273 | ["equiv"] = 0x2261, 274 | ["le"] = 0x2264, 275 | ["ge"] = 0x2265, 276 | ["sub"] = 0x2282, 277 | ["sup"] = 0x2283, 278 | ["nsub"] = 0x2284, 279 | ["sube"] = 0x2286, 280 | ["supe"] = 0x2287, 281 | ["oplus"] = 0x2295, 282 | ["otimes"] = 0x2297, 283 | ["perp"] = 0x22A5, 284 | ["sdot"] = 0x22C5, 285 | ["lceil"] = 0x2308, 286 | ["rceil"] = 0x2309, 287 | ["lfloor"] = 0x230A, 288 | ["rfloor"] = 0x230B, 289 | ["lang"] = 0x27E8, 290 | ["rang"] = 0x27E9, 291 | ["loz"] = 0x25CA, 292 | ["spades"] = 0x2660, 293 | ["clubs"] = 0x2663, 294 | ["hearts"] = 0x2665, 295 | ["diams"] = 0x2666, 296 | } 297 | 298 | --- Given a string of decimal digits, returns a UTF-8 encoded 299 | -- string encoding a unicode character. 300 | function M.dec_entity(s) 301 | local out = string.gsub(s, '&#(%d+);', to_utf8) 302 | return out 303 | end 304 | 305 | --- Given a character entity name (like `ouml`), returns a UTF-8 encoded 306 | -- string encoding a unicode character. 307 | -- NOT WORKING: REQUIRES UNICODE. 308 | --[[function M.char_entity(s) 309 | local i = s:match('&(%a+);') 310 | local n = character_entities[i] 311 | local s 312 | if (n) then 313 | s = char(n) 314 | end 315 | return s 316 | end 317 | --]] 318 | 319 | function M.convert(s) 320 | if (s) then 321 | return M.dec_entity(s) 322 | else 323 | return s 324 | end 325 | end 326 | 327 | -- UNUSED 328 | -- Find the entity, get the character, OR return NIL 329 | --[[ 330 | local function get_character_entity(s) 331 | local c = character_entities[s] 332 | print ("C",c) 333 | if ( c ) then 334 | return char(c) 335 | end 336 | return nil 337 | end 338 | --]] 339 | 340 | local gsub, char = string.gsub, string.char 341 | local entitySwap = function(orig,n,s) 342 | local ss = to_utf8(tonumber(character_entities[s])) 343 | --print ("entitySwap: orig,n,s,ss",orig,ss,n,s) 344 | return ss or n=="#" and to_utf8(s) or orig 345 | end 346 | function M.unescape(str) 347 | return gsub( str, '(&(#?)([%d%a]+);)', entitySwap ) 348 | end 349 | 350 | --&#039; 351 | 352 | return M 353 | -------------------------------------------------------------------------------- /examples/scripts/textrender/fontmetrics.lua: -------------------------------------------------------------------------------- 1 | -- fontmetrics.lua 2 | -- 3 | -- Version 0.3 4 | -- 5 | -- Copyright (C) 2011 David I. Gross. All Rights Reserved. 6 | -- 7 | --[[ 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | this software and associated documentation files (the "Software"), to deal in the 10 | Software without restriction, including without limitation the rights to use, copy, 11 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, subject to the 13 | following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all copies 16 | or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 19 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 20 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 21 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 22 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | --]] 25 | 26 | -- 27 | -- =================== 28 | -- FONT METRICS FUNCTIONS 29 | -- =================== 30 | 31 | --[[ 32 | 33 | Return font metrics that tell how to position a font correctly. 34 | 35 | Font metrics for 72pt Baskerville "A" are: 36 | 37 | characterWidth = 72 38 | characterHeight = 72 39 | ascender = 64 40 | descender = -18 41 | textWidth = 50.953125 42 | textHeight = 81 43 | maxHorizontalAdvance = 84 44 | boundingBox = Array 45 | originX = 49 46 | originY = 0 47 | 48 | 49 | 50 | The metrics file is a list of font names and values. 51 | 52 | Format of the source file: 53 | name = characterWidth, characterHeight, ascender, descender, textWidth, textHeight, maxHorizontalAdvance, originX, originY 54 | 55 | 56 | baseline : is the distance from the very top of the font to the baseline, as rendered by Corona, as a percentage of the requested font size. So, for a 300px font, if the baseline is 1.0, then the baseline of the font is at 300px from the top of the font (right where it should be) 57 | 58 | capheight : the height of a capital "X", as a percentage of the size. So, for a 300px font, if the capheight is 0.65, then the "X" of the 300px font is 0.65 * 300 = 195px. 59 | 60 | e.g. 61 | CrimsonText-Roman=1.0, 0.65 62 | 63 | 64 | This returns a metrics table, which has the baseline, capheight, ascent, and height 65 | 66 | baseline: see above 67 | capheight: see above 68 | ascent: baseline - capheight 69 | height: the percentage of the requested size, e.g. 300px, that the text really is. Ask for 300px of 70 | font X, and you might get something 400px high. Use : height * size = real size, e.g. if height 71 | of the font at 300px really is 400px, then the value will be 1.33, and 1.33 x 300 = 400px 72 | 73 | ]] 74 | 75 | local FM = {} 76 | 77 | local funx = require ("scripts.funx") 78 | 79 | local function loadMetricsFromFile (metricsfile, fontfacesfile, path) 80 | local metricsPacked = {} 81 | local variations = {} 82 | 83 | metricsfile = metricsfile or "scripts/textrender/fontmetrics.txt" 84 | 85 | local metrics = { variations = {}, } 86 | 87 | if (metricsfile) then 88 | path = path or system.SystemDirectory 89 | local filePath = system.pathForFile( metricsfile, path ) 90 | metricsPacked = funx.loadTableFromFile(filePath, "\n") 91 | else 92 | return metrics 93 | end 94 | 95 | 96 | if (not metricsPacked) then 97 | return metrics 98 | end 99 | 100 | local x = 0 101 | for n,v in pairs(metricsPacked) do 102 | 103 | local vv = funx.split(v,",") 104 | 105 | --[[ 106 | 107 | # fontname = sampledFontSize, characterWidth, characterHeight, ascender, descender, textWidth, textHeight, maxHorizontalAdvance, originX, originY, boundingBoxX1, boundingBoxY1, boundingBoxX2, boundingBoxY2 108 | 109 | The 26.6 fixed float format used to define fractional pixel coordinates. Here, 1 unit = 1/64 pixel. 110 | 111 | Bounding Box: xMin, yMin, xMax, yMax 112 | xMin 113 | The horizontal minimum (left-most). 114 | 115 | yMin 116 | The vertical minimum (bottom-most). 117 | 118 | xMax 119 | The horizontal maximum (right-most). 120 | 121 | yMax 122 | The vertical maximum (top-most). 123 | 124 | The bounding box is specified with the coordinates of the lower left and the upper right corner. In PostScript, those values are often called (llx,lly) and (urx,ury), respectively. 125 | 126 | If ‘yMin’ is negative, this value gives the glyph's descender. Otherwise, the glyph doesn't descend below the baseline. Similarly, if ‘ymax’ is positive, this value gives the glyph's ascender. 127 | 128 | ‘xMin’ gives the horizontal distance from the glyph's origin to the left edge of the glyph's bounding box. If ‘xMin’ is negative, the glyph extends to the left of the origin. 129 | 130 | --]] 131 | 132 | -- table.remove takes from the end (i.e. "pop") 133 | local y2 = tonumber(table.remove(vv) ) 134 | local x2 = tonumber(table.remove(vv) ) 135 | local y1 = tonumber(table.remove(vv) ) 136 | local x1 = tonumber(table.remove(vv) ) 137 | 138 | local originY = tonumber(table.remove(vv) ) 139 | local originX = tonumber(table.remove(vv) ) 140 | local maxHorizontalAdvance = tonumber(table.remove(vv) ) 141 | local textHeight = tonumber(table.remove(vv) ) 142 | local textWidth = tonumber(table.remove(vv) ) 143 | local descender = tonumber(table.remove(vv) ) 144 | local ascender = tonumber(table.remove(vv) ) 145 | local characterHeight = tonumber(table.remove(vv) ) 146 | local characterWidth = tonumber(table.remove(vv) ) 147 | local sampledFontSize = tonumber(table.remove(vv) ) 148 | 149 | local baseline = descender/sampledFontSize 150 | local capheight = (y2-y1)/sampledFontSize 151 | 152 | metrics[n] = { 153 | capheight = capheight, 154 | baseline = baseline, 155 | ascent = ascender/sampledFontSize, 156 | textHeight = textHeight/sampledFontSize, 157 | descent = descender/sampledFontSize, 158 | maxCharWidth = maxHorizontalAdvance/sampledFontSize, 159 | 160 | originY = originY, 161 | originX = originX, 162 | maxHorizontalAdvance = maxHorizontalAdvance, 163 | textHeight = textHeight, 164 | textWidth = textWidth, 165 | descender = descender, 166 | ascender = ascender, 167 | characterHeight = characterHeight, 168 | characterWidth = characterWidth, 169 | sampledFontSize = sampledFontSize, 170 | 171 | x1 = x1, 172 | y1 = y1, 173 | x2 = x2, 174 | y2 = y2, 175 | 176 | } 177 | end 178 | --funx.dump(metrics) 179 | 180 | 181 | ------------ 182 | -- Get font transformation names, e.g. myfont-italic 183 | fontfacesfile = fontfacesfile or "scripts/textrender/fontvariations.txt" 184 | 185 | if (fontfacesfile) then 186 | path = path or system.SystemDirectory 187 | local filePath = system.pathForFile( fontfacesfile, path ) 188 | variations = funx.loadTableFromFile(filePath, "\n") 189 | end 190 | metrics.variations = variations 191 | 192 | 193 | return metrics 194 | end 195 | 196 | 197 | --------------- 198 | -- Return a font metrics object 199 | function FM.new(metricsfile, fontfacesfile) 200 | local M = {} 201 | 202 | metricsfile = metricsfile or "scripts/textrender/fontmetrics.txt" 203 | fontfacesfile = fontfacesfile or "scripts/textrender/fontvariations.txt" 204 | local metrics = loadMetricsFromFile(metricsfile, fontfacesfile) 205 | 206 | M.metrics = metrics 207 | 208 | 209 | -- Get the metrics for a font. 210 | -- If we don't know, guess. 211 | function M.getMetrics(f) 212 | local fontInfo = {} 213 | fontInfo = metrics[f] 214 | if (not fontInfo) then 215 | print ("WARNING: fontmetrics doesn't have info about the font, '"..tostring(f).."', using Baskerville settings.") 216 | -- unknown font 217 | fontInfo = { 218 | x1=-2.953125, 219 | x2=47.109375, 220 | y1=0.609375, 221 | y2=49, 222 | textHeight=81, 223 | characterWidth=72, 224 | descent=-0.25, 225 | originY=0, 226 | ascent=0.88888888888889, 227 | sampledFontSize=72, 228 | ascender=64, 229 | baseline=-0.25, 230 | originX=49, 231 | characterHeight=72, 232 | textWidth=50.953125, 233 | maxCharWidth=1.1666666666667, 234 | maxHorizontalAdvance=84, 235 | descender=-18, 236 | capheight=0.67209201388889, 237 | } 238 | if (type(f) ~= "string") then 239 | print ("WARNING: fontmetrics was sent a font value that was not a name, probably a .user value.") 240 | end 241 | end 242 | return fontInfo 243 | end 244 | ---------- 245 | 246 | --funx.dump(metrics) 247 | 248 | 249 | return M 250 | end -- new 251 | 252 | return FM -------------------------------------------------------------------------------- /examples/scripts/textrender/fontmetrics.txt: -------------------------------------------------------------------------------- 1 | ### fontname = sampledFontSize, characterWidth, characterHeight, ascender, descender, textWidth, textHeight, maxHorizontalAdvance, originX, originY, BoundingBox.x1, BoundingBox.y1, BoundingBox.x2, BoundingBox.y2 2 | 3 | APHont-BoldItalic_q15c = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 4 | APHont-Bold_q15c = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 5 | APHont-Italic_q15c = 72, 72, 72, 55, -22, 0, 79, 109, 0, 0, 0, -0.34375, 0.515625, 0.515625 6 | APHont-Regular_q15c = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 7 | 8 | APHont-BoldItalic = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 9 | APHont-Bold = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 10 | APHont-Italic = 72, 72, 72, 55, -22, 0, 79, 109, 0, 0, 0, -0.34375, 0.515625, 0.515625 11 | APHont = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 12 | 13 | #ASafePlacetoFall = 72, 72, 72, 99, -50, 1, 149, 74, 0, 0, 0, -30, 45, 60 14 | ### the ascender as written in the file is off compared to how it draws: 15 | ASafePlacetoFall = 72, 72, 72, 158, -50, 1, 149, 74, 0, 0, 0, -0.78125, 0.765625, 0.765625 16 | 17 | AmericanTypewriter = 72, 72, 72, 66, -18, 48, 83, 135, 48, 0, 0, -0.28125, 43, 63.5 18 | 19 | Apple Symbols = 72, 72, 72, 48, -18, 38.21875, 72, 225, 37, 0, 0.78125, 0, 36.390625, 39.421875 20 | AppleSDGothicNeo-Bold = 72, 72, 72, 65, -22, 50, 86, 97, 50, 0, 1, 3.25, 50, 56 21 | AppleSDGothicNeo-Regular = 72, 72, 72, 65, -22, 48, 86, 94, 48, 0, 1, 3.671875, 47, 55 22 | 23 | ArchitectsDaughter = 72, 72, 72, 87, -38, 3, 126, 109, 0, 0, 0, -0.59375, 0.765625, 0.765625 24 | 25 | Arbitrary = 72, 72, 72, 52, 15, 35, 36, 84, 36, 0, 0, 0, 34.5, 72 26 | ArbitraryBold = 72, 72, 72, 72, -16, 35, 87, 83, 36, 0, 0, -0.25, 34.5, 72.546875 27 | 28 | AvenirNext Condensed = 72, 72, 72, 72, -27, 39, 98, 70, 38, 0, 0, 0, 38.390625, 51 29 | AvenirNext = 72, 72, 72, 72, -27, 53.984375, 98, 90, 51, 0, -0.984375, 0, 52.421875, 50.875 30 | AvenirNext-Medium = 72, 72, 72, 72, -27, 53.984375, 98, 90, 51, 0, -0.984375, 0, 52.421875, 50.875 31 | Avenir = 72, 72, 72, 72, -27, 50, 98, 72, 49, 0, 0, 0, 49.390625, 51.625 32 | 33 | AvenirNext-DemiBoldItalic = 72, 72, 72, 72, -27, 54.265625, 98, 86, 48, 0, -6.265625, 0, 44.859375, 52.046875 34 | AvenirNext-DemiBold = 72, 72, 72, 72, -27, 52.578125, 98, 89, 51, 0, -0.578125, 0, 51.40625, 51.9375 35 | AvenirNext-Bold = 72, 72, 72, 72, -27, 52.578125, 98, 89, 51, 0, -0.578125, 0, 51.40625, 51.9375 36 | AvenirNext-HeavyItalic = 72, 72, 72, 72, -27, 60.859375, 98, 91, 55, 0, -5.859375, 0, 50.796875, 51.609375 37 | AvenirNext-Heavy = 72, 72, 72, 72, -27, 57.125, 98, 91, 55, 0, -1.125, 0, 55.890625, 50.15625 38 | AvenirNext-Italic = 72, 72, 72, 72, -27, 53.671875, 98, 72, 50, 0, -3.671875, 0, 44.78125, 52.25 39 | AvenirNext-BoldItalic = 72, 72, 72, 72, -27, 53.671875, 98, 72, 50, 0, -3.671875, 0, 44.78125, 52.25 40 | AvenirNext-MediumItalic = 72, 72, 72, 72, -27, 49.796875, 98, 75, 48, 0, -4.796875, 1, 44.03125, 51.125 41 | AvenirNext-Medium = 72, 72, 72, 72, -27, 49.640625, 98, 75, 50, 0, 0.359375, 1, 49.8125, 51.125 42 | AvenirNext-Regular = 72, 72, 72, 72, -27, 49.28125, 98, 72, 50, 0, 0.71875, 0, 49.6875, 52.25 43 | AvenirNext-UltraLightItalic = 72, 72, 72, 72, -27, 47.609375, 98, 72, 45, 0, -2.609375, -0.265625, 40.71875, 50.96875 44 | AvenirNext-UltraLight = 72, 72, 72, 72, -27, 45.734375, 98, 73, 47, 0, 1.265625, -0.265625, 45.71875, 50.96875 45 | 46 | 47 | Avenir-Black = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 48 | Avenir-BlackOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 49 | Avenir-Book = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 50 | Avenir-BookOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 51 | Avenir-Heavy = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 52 | Avenir-HeavyOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 53 | Avenir-Light = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 54 | Avenir-LightOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 55 | Avenir-Medium = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 56 | Avenir-MediumOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 57 | Avenir-Oblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 58 | Avenir-Roman = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 59 | 60 | Baskerville = 72, 72, 72, 65, -18, 49, 82, 72, 49, 0, 0, -0.625, 49, 48 61 | Baskerville-Bold = 72, 72, 72, 65, -19, 49, 83, 84, 47, 0, -1, 0.125, 48, 49 62 | Baskerville-BoldItalic = 72, 72, 72, 64, -18, 50.953125, 81, 84, 49, 0, -2.953125, 0.609375, 47.109375, 49 63 | Baskerville-Italic = 72, 72, 72, 64, -18, 44.34375, 81, 72, 41, 0, -5.34375, 0, 38.046875, 49 64 | Baskerville-SemiBold = 72, 72, 72, 65, -18, 49, 82, 80, 50, 0, 1, 0, 49, 49 65 | Baskerville-SemiBoldItalic = 72, 72, 72, 65, -18, 48.421875, 83, 74, 44, 0, -5.421875, 0.03125, 43, 49 66 | 67 | ### Fixed the ascender from 54 -> 72: 68 | BobbyJ-Regular = 72, 72, 72, 72, -18, 3, 72, 45, 0, 0, 0, -0.28125, 0.5625, 0.5625 69 | ### changed ascender to 88 from 72 for proper centering 70 | BobbyJ-Bold = 72, 72, 72, 88, -18, 3, 73, 45, 0, 0, 0, -0.28125, 0.5625, 0.5625 71 | ### original value: 72 | ### BobbyJ-Bold = 72, 72, 72, 72, -18, 3, 73, 45, 0, 0, 0, -0.28125, 0.5625, 0.5625 73 | BobbyJRough-Bd = 72, 72, 72, 72, -18, 3, 73, 46, 0, 0, 0, -0.28125, 0.5625, 0.5625 74 | BobbyJRough-Rg = 72, 72, 72, 72, -18, 3, 73, 45, 0, 0, 0, -0.28125, 0.5625, 0.5625 75 | BobbyJSerif-Bld = 72, 72, 72, 72, -18, 3, 73, 50, 0, 0, 0, -0.28125, 0.5625, 0.5625 76 | BobbyJSerif-Rg = 72, 72, 72, 72, -18, 3, 73, 46, 0, 0, 0, -0.28125, 0.5625, 0.5625 77 | 78 | BodoniOrnamentsITCTT = 72, 72, 72, 72, -14.4, 42, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 79 | 80 | Courier = 72, 72, 72, 55, -18, 43, 72, 59, 43, 0, 0, 0, 43, 41 81 | CrimsonText-Bold = 72, 72, 72, 78, -52, 51, 136, 89, 50, 0, 1, 0, 50, 46 82 | CrimsonText-Italic = 72, 72, 72, 64, -19, 42.859375, 89, 80, 43, 0, 0.140625, 0, 42.609375, 48 83 | CrimsonText-Roman = 72, 72, 72, 73, -21, 46, 100, 79, 47, 0, 1, 0, 46, 47 84 | CrimsonText-Semibold = 72, 72, 72, 74, -18, 53, 98, 84, 51, 0, 2, 0, 49, 47 85 | CrimsonText-Semibold = 72, 72, 72, 74, -18, 53, 98, 84, 51, 0, 2, 0, 49, 47 86 | CrimsonText-SemiboldItalic = 72, 72, 72, 74, -18, 47.828125, 97, 85, 45, 0, -0.828125, -0.203125, 42.65625, 47 87 | Futura = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 88 | Futura-Bold = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 89 | Futura-BoldOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 90 | Futura-Book t1 = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 91 | Futura-Book t1 2 = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 92 | Futura-BookOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 93 | Futura-Condensed = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 94 | Futura-CondensedBold = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 95 | Futura-CondensedBoldOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 96 | Futura-CondensedExtraBold = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 97 | Futura-CondensedLight t1 = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 98 | Futura-CondensedLight t1 2 = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 99 | Futura-CondensedLightOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 100 | Futura-CondensedOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 101 | Futura-CondExtraBoldObl = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 102 | Futura-ExtraBold = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 103 | Futura-ExtraBoldOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 104 | Futura-Heavy = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 105 | Futura-HeavyOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 106 | Futura-Light = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 107 | Futura-Medium = 72, 72, 72, 60, -13, 52, 86, 82, 51, 0, -1, 0, 51, 57.109375 108 | Futura-MediumItalic = 72, 72, 72, 60, -13, 52, 86, 82, 51, 0, -1, 0, 51, 57.109375 109 | Futura-Oblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 110 | Geeza Pro = 72, 72, 72, 65, -24, 33, 98, 467, 33, 0, 5, 7, 27.625, 51.59375 111 | Geeza Pro Bold = 72, 72, 72, 65, -24, 33, 98, 467, 33, 0, 5, 7, 27.625, 51.59375 112 | Geneva = 72, 72, 72, 72, -18, 51.9375, 96, 124, 51, 0, 1.0625, 0, 50.234375, 54.203125 113 | Georgia = 72, 72, 72, 67, -16, 51, 82, 132, 48, 0, -1, 0, 50, 51.484375 114 | Georgia-Bold = 72, 72, 72, 67, -16, 58, 82, 151, 54, 0, -2, 0, 56, 50.515625 115 | Georgia-Bold-Italic = 72, 72, 72, 67, -16, 60.125, 82, 152, 55, 0, -6.125, 0, 53.015625, 51.03125 116 | Georgia-Italic = 72, 72, 72, 67, -16, 51.515625, 82, 132, 47, 0, -5.515625, 0, 45.375, 49.9375 117 | 118 | Helvetica = 72, 72, 72, 56, -17, 46.9375, 72, 108, 48, 0, 1.0625, 0, 47.140625, 52 119 | 120 | HelveticaNeue = 72, 72, 72, 69, -16, 47.421875, 86, 83, 46, 0, -0.421875, 0, 46.28125, 51 121 | HelveticaNeue-Bold = 72, 72, 72, 71, -16, 49.421875, 88, 83, 48, 0, -0.421875, 0, 48.828125, 51 122 | HelveticaNeue-BoldItalic = 72, 72, 72, 71, -16, 53.359375, 88, 81, 48, 0, -5.359375, -0.375, 44.09375, 51 123 | HelveticaNeue-CondensedBlack = 72, 72, 72, 70, -17, 41.71875, 88, 80, 40, 0, -0.71875, -0.015625, 40.96875, 51.359375 124 | HelveticaNeue-CondensedBold = 72, 72, 72, 70, -16, 41, 87, 79, 40, 0, 0, 0, 40.03125, 52.25 125 | HelveticaNeue-Italic = 72, 72, 72, 69, -16, 50.8125, 86, 77, 47, 0, -3.8125, 0, 42.90625, 51 126 | HelveticaNeue-Light = 72, 72, 72, 70, -16, 45.421875, 87, 80, 44, 0, -0.421875, 0, 44.953125, 51 127 | HelveticaNeue-LightItalic = 72, 72, 72, 69, -16, 49.21875, 86, 76, 44, 0, -5.21875, 0, 39.9375, 51 128 | HelveticaNeue-UltraLight = 72, 72, 72, 68, -16, 43.796875, 84, 75, 41, 0, -0.796875, 0, 42.1875, 52 129 | HelveticaNeue-UltraLightItalic = 72, 72, 72, 67, -16, 46.46875, 84, 75, 41, 0, -5.46875, 0, 37.578125, 52 130 | 131 | HollywoodDecoSG-Medium = 72, 72, 72, 68, -14, 40.703125, 81, 85, 42, 0, 1.296875, 0, 41.046875, 55.046875 132 | HollywoodDecoSG-Medium = 72, 72, 72, 68, -14, 40.703125, 81, 85, 42, 0, 1.296875, 0, 41.046875, 55.046875 133 | 134 | JournalBold = 72, 72, 72, 54, -19, 0, 73, 101, 0, 0, 0, -0.296875, 0.546875, 0.546875 135 | JournalDingbatsTenSSK = 72, 72, 72, 65, -9, 2, 73, 113, 0, 0, 0, -0.140625, 0.875, 0.875 136 | JournalItalic = 72, 72, 72, 54, -19, 0, 73, 79, 0, 0, 0, -0.296875, 0.546875, 0.546875 137 | JournalText = 72, 72, 72, 54, -19, 0, 73, 80, 0, 0, 0, -0.296875, 0.546875, 0.546875 138 | JournalTextFractions = 72, 72, 72, 36, 0, 0, 36, 87, 0, 0, 0, 0, 0.5625, 0.5625 139 | JournalUltraSmallcaps = 72, 72, 72, 55, -19, 0, 73, 99, 0, 0, 0, -0.296875, 0.5625, 0.5625 140 | JournalUltra_Medium = 72, 72, 72, 55, -19, 0, 73, 102, 0, 0, 0, -0.296875, 0.5625, 0.5625 141 | Journal_Bold_Oblique = 72, 72, 72, 63, -23, 0, 85, 43, 0, 0, 0, -0.359375, 0.625, 0.625 142 | 143 | LucidaGrande = 72, 72, 72, 70, -16, 48.421875, 85, 118, 49, 0, 0.578125, 0, 47.890625, 51.3125 144 | 145 | LoveYaLikeASister = 72, 72, 72, 92, -33, 3, 125, 110, 0, 0, 0, -0.515625, 0.921875, 0.921875 146 | LoveYaLikeASisterSolid = 72, 72, 72, 92, -33, 3, 124, 110, 0, 0, 0, -0.515625, 0.921875, 0.921875 147 | 148 | Noteworthy-Light = 72, 72, 72, 93, -24, 0, 116, 96, 0, 0, 0, -0.375, 1.078125, 1.078125 149 | Noteworthy-Bold = 72, 72, 72, 93, -24, 0, 116, 107, 0, 0, 0, -0.375, 1.078125, 1.078125 150 | 151 | MarkerFelt = 72, 72, 72, 63, -16, 44, 78, 83, 45, 0, 2, -2, 43, 59 152 | Menlo = 72, 72, 72, 67, -17, 40.71875, 84, 43, 42, 0, 1.28125, 0, 41.203125, 52.28125 153 | Monaco = 72, 72, 72, 72, -18, 42.859375, 96, 44, 42, 0, 1.140625, 0, 41.234375, 54.203125 154 | Montserrat-Bold = 72, 72, 72, 70, -19, 58.359375, 88, 80, 53, 0, -0.359375, 0, 52.921875, 50.296875 155 | Montserrat-Regular = 72, 72, 72, 70, -19, 58, 88, 84, 53, 0, 0, 0, 53.421875, 50.125 156 | 157 | Noteworthy = 72, 72, 72, 93, -24, 45, 116, 96, 46, 0, 1, -3, 45, 61 158 | OriyaMN = 72, 72, 72, 65, -21, 48.828125, 87, 82, 49, 0, 0.171875, 0, 48.875, 50.765625 159 | Symbol = 72, 72, 72, 51, -22, 27, 72, 75, 32, 0, 4, -1, 27.578125, 49 160 | 161 | TalkingtotheMoon = 72, 72, 72, 72, -37, 1, 109, 62, 0, 0, 0, -0.578125, 0.546875, 0.546875 162 | 163 | TechnoRegular = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 164 | Thonburi = 72, 72, 72, 78, -17, 51.921875, 99, 105, 51, 0, 1.078125, 0, 50.25, 54.1875 165 | ThonburiBold = 72, 72, 72, 78, -17, 52.78125, 99, 105, 51, 0, 0.21875, 0, 50.28125, 53.609375 166 | Times = 72, 72, 72, 54, -18, 50, 72, 124, 51, 0, 1, 0, 50, 48.25 167 | 168 | TitilliumWeb-Black = 72, 72, 72, 82, -28, 48.359375, 110, 119, 45, 0, -0.359375, 0.21875, 45.515625, 48 169 | TitilliumWeb-Bold = 72, 72, 72, 82, -28, 48.78125, 110, 81, 43, 0, 1.21875, 0, 42.125, 49.234375 170 | TitilliumWeb-BoldItalic = 72, 72, 72, 82, -28, 40.0625, 110, 74, 40, 0, 0.9375, 0.453125, 40.109375, 49.25 171 | TitilliumWeb-ExtraLight = 72, 72, 72, 82, -28, 48.984375, 110, 82, 43, 0, 2.015625, 0, 40.609375, 51 172 | TitilliumWeb-ExtraLightItalic = 72, 72, 72, 82, -28, 42.703125, 110, 82, 40, 0, 2.296875, 0, 38.15625, 51 173 | TitilliumWeb-Italic = 72, 72, 72, 82, -28, 40.265625, 110, 79, 40, 0, 1.734375, 0, 38.296875, 50 174 | TitilliumWeb-Light = 72, 72, 72, 82, -28, 48.203125, 110, 82, 43, 0, 1.796875, 0, 40.96875, 50 175 | TitilliumWeb-LightItalic = 72, 72, 72, 82, -28, 41.0625, 110, 80, 40, 0, 1.9375, 0, 38.234375, 51 176 | TitilliumWeb-Regular = 72, 72, 72, 82, -28, 48.265625, 110, 82, 43, 0, 1.734375, 0, 41.1875, 50 177 | TitilliumWeb-SemiBold = 72, 72, 72, 82, -28, 48.5625, 110, 81, 43, 0, 1.4375, 0, 41.765625, 50 178 | TitilliumWeb-SemiBoldItalic = 72, 72, 72, 82, -28, 37.703125, 110, 76, 40, 0, 1.296875, -0.328125, 38.875, 49 179 | 180 | Noteworthy_0 = 72, 72, 72, 93, -24, 0, 116, 96, 0, 0, 0, -0.375, 1.078125, 1.078125 181 | Noteworthy_1 = 72, 72, 72, 93, -24, 0, 116, 107, 0, 0, 0, -0.375, 1.078125, 1.078125 182 | 183 | NothingYouCouldSay = 72, 72, 72, 87, -33, 3, 119, 89, 0, 0, 0, -0.515625, 0.84375, 0.84375 184 | 185 | NuevaStd-Bold = 72, 72, 72, 49, -24, 45, 86, 80, 43, 0, -1, 0, 44, 45 186 | NuevaStd-BoldCond = 72, 72, 72, 49, -24, 33, 86, 64, 31, 0, -2, 0, 31, 45 187 | NuevaStd-BoldCondItalic = 72, 72, 72, 49, -24, 30.546875, 86, 58, 29, 0, -3.546875, 0, 26.046875, 44 188 | NuevaStd-Cond = 72, 72, 72, 49, -24, 31, 86, 58, 30, 0, -1, 0, 30, 45 189 | NuevaStd-CondItalic = 72, 72, 72, 49, -24, 28.875, 86, 57, 27, 0, -3.875, 0, 24.375, 45 190 | NuevaStd-Italic = 72, 72, 72, 49, -24, 39, 86, 65, 37, 0, -4, 0, 35, 44 191 | 192 | SpecialElite-Regular = 72, 72, 72, 51, -22, 49, 72, 80, 40, 0, 0, -1, 40, 51 193 | 194 | Nymphette = 72, 72, 72, 65, -12, 1, 76, 124, 0, 0, 0, -0.1875, 0.828125, 0.828125 195 | Oriya MN = 72, 72, 72, 65, -21, 0, 87, 82, 0, 0, 0, -0.328125, 0.6875, 0.6875 196 | Raleway Thin = 72, 72, 72, 54, -18, 6, 72, 86, 0, 0, 0, -0.28125, 0.5625, 0.5625 197 | SpecialElite = 72, 72, 72, 51, -22, 9, 72, 80, 0, 0, 0, -0.34375, 0.453125, 0.453125 198 | Symbol = 72, 72, 72, 51, -22, 0, 72, 75, 0, 0, 0, -0.34375, 0.453125, 0.453125 199 | TalkingToTheMoon = 72, 72, 72, 72, -37, 1, 109, 62, 0, 0, 0, -0.578125, 0.546875, 0.546875 200 | Thonburi = 72, 72, 72, 78, -17, 2, 99, 105, 0, 0, 0, -0.265625, 0.953125, 0.953125 201 | ThonburiBold = 72, 72, 72, 78, -17, 2, 99, 105, 0, 0, 0, -0.265625, 0.953125, 0.953125 202 | Times = 72, 72, 72, 54, -18, 0, 72, 124, 0, 0, 0, -0.28125, 0.5625, 0.5625 203 | TitilliumWeb-Black = 72, 72, 72, 82, -28, 3, 110, 119, 0, 0, 0, -0.4375, 0.84375, 0.84375 204 | TitilliumWeb-Bold = 72, 72, 72, 82, -28, 7, 110, 81, 0, 0, 0, -0.4375, 0.84375, 0.84375 205 | TitilliumWeb-BoldItalic = 72, 72, 72, 82, -28, 0, 110, 74, 0, 0, 0, -0.4375, 0.84375, 0.84375 206 | TitilliumWeb-ExtraLight = 72, 72, 72, 82, -28, 8, 110, 82, 0, 0, 0, -0.4375, 0.84375, 0.84375 207 | TitilliumWeb-ExtraLightItalic = 72, 72, 72, 82, -28, 5, 110, 82, 0, 0, 0, -0.4375, 0.84375, 0.84375 208 | TitilliumWeb-Italic = 72, 72, 72, 82, -28, 2, 110, 79, 0, 0, 0, -0.4375, 0.84375, 0.84375 209 | TitilliumWeb-Light = 72, 72, 72, 82, -28, 7, 110, 82, 0, 0, 0, -0.4375, 0.84375, 0.84375 210 | TitilliumWeb-LightItalic = 72, 72, 72, 82, -28, 3, 110, 80, 0, 0, 0, -0.4375, 0.84375, 0.84375 211 | TitilliumWeb-Regular = 72, 72, 72, 82, -28, 7, 110, 82, 0, 0, 0, -0.4375, 0.84375, 0.84375 212 | TitilliumWeb-SemiBold = 72, 72, 72, 82, -28, 7, 110, 81, 0, 0, 0, -0.4375, 0.84375, 0.84375 213 | TitilliumWeb-SemiBoldItalic = 72, 72, 72, 82, -28, 0, 110, 76, 0, 0, 0, -0.4375, 0.84375, 0.84375 214 | 215 | VastShadow-Regular = 72, 72, 72, 66, -25, 75, 90, 107, 74, 0, 0, -3.8125, 74.140625, 43.875 216 | ZapfDingbats = 72, 72, 72, 59, -13, 37, 71, 73, 37, 0, 4, -10, 33, 51.046875 217 | 218 | ### ANDROID FONTS 219 | 220 | Roboto-Black = 72, 72, 72, 67, -18, 46.8594, 84, 87, 46, 0, 0.140625, 0, 45.8125, 52 221 | Roboto-BlackItalic = 72, 72, 72, 67, -18, 54.4844, 84, 85, 45, 0, -3.48438, 0, 49.0781, 51.3906 222 | Roboto-Bold = 72, 72, 72, 67, -18, 46.2188, 84, 86, 46, 0, 0.78125, 0, 45, 52 223 | Roboto-BoldItalic = 72, 72, 72, 67, -18, 52.8438, 84, 84, 45, 0, -2.84375, 0, 48.3125, 51.3906 224 | Roboto-Italic = 72, 72, 72, 67, -18, 49.5469, 84, 82, 44, 0, -1.54688, 0, 46.5156, 51.5 225 | Roboto-Light = 72, 72, 72, 67, -18, 43.0625, 84, 83, 44, 0, 1.9375, 0, 42.1562, 52 226 | Roboto-LightItalic = 72, 72, 72, 67, -18, 48.5781, 84, 81, 43, 0, -1.57812, 0, 45.25, 51.5 227 | Roboto-Medium = 72, 72, 72, 67, -18, 45.5625, 84, 85, 46, 0, 1.4375, 0, 44.1875, 52 228 | Roboto-MediumItalic = 72, 72, 72, 67, -18, 51.1406, 84, 83, 45, 0, -2.14062, 0, 47.5, 51.3906 229 | Roboto-Regular = 72, 72, 72, 67, -18, 44, 84, 84, 45, 0, 2, 0, 43.25, 52 230 | Roboto-Thin = 72, 72, 72, 67, -18, 41.0938, 84, 82, 43, 0, 1.90625, 0, 41.0625, 52 231 | Roboto-ThinItalic = 72, 72, 72, 67, -18, 46.4844, 84, 81, 42, 0, -1.48438, 0, 43.9062, 52 232 | 233 | -------------------------------------------------------------------------------- /examples/scripts/textrender/fontvariations.txt: -------------------------------------------------------------------------------- 1 | # Table of fonts and their variation names. 2 | # For some, like Avenir, this is not obvious. 3 | # Avenir Roman is the base, but the italic should be Avenir-Oblique, and 4 | # the bold would be Avenir-Medium. 5 | # We retain in this list the Roman fonts, just for reference, 6 | # e.g. #ArialMT = ArialMT 7 | 8 | # 9 | # iOS Fonts for iOS 6.0 10 | # 11 | 12 | #Academy Engraved LET 13 | #AcademyEngravedLetPlain = AcademyEngravedLetPlain 14 | 15 | #American Typewriter 16 | #AmericanTypewriter = AmericanTypewriter 17 | AmericanTypewriter-Bold = AmericanTypewriter-Bold 18 | AmericanTypewriter-Condensed = AmericanTypewriter-Condensed 19 | AmericanTypewriter-CondensedBold = AmericanTypewriter-CondensedBold 20 | AmericanTypewriter-CondensedLight = AmericanTypewriter-CondensedLight 21 | AmericanTypewriter-Light = AmericanTypewriter-Light 22 | 23 | APHont-BoldItalic = APHont-BoldItalic 24 | APHont-Bold = APHont-Bold 25 | APHont-Italic = APHont-Italic 26 | APHont = APHont-Regular 27 | 28 | #Apple Color Emoji 29 | #AppleColorEmoji = AppleColorEmoji 30 | 31 | #Apple SD Gothic Neo 32 | AppleSDGothicNeo-Bold = AppleSDGothicNeo-Bold 33 | AppleSDGothicNeo-Medium = AppleSDGothicNeo-Medium 34 | 35 | #Arial 36 | #ArialMT = ArialMT 37 | Arial-BoldItalicMT = Arial-BoldItalicMT 38 | Arial-BoldMT = Arial-BoldMT 39 | Arial-ItalicMT = Arial-ItalicMT 40 | 41 | #Arial Hebrew 42 | #ArialHebrew = ArialHebrew 43 | ArialHebrew-Bold = ArialHebrew-Bold 44 | 45 | #Arial Rounded MT Bold 46 | #ArialRoundedMTBold = ArialRoundedMTBold 47 | 48 | #ASafePlacetoFall-Italic = TalkingtotheMoon 49 | ASafePlacetoFall-Italic = ASafePlacetoFall 50 | 51 | 52 | #Avenir 53 | Avenir-Bold = Avenir-Black 54 | Avenir-BoldItalic = Avenir-BlackOblique 55 | Avenir-Italic = Avenir-Oblique 56 | Avenir-Black = Avenir-Black 57 | Avenir-BlackOblique = Avenir-BlackOblique 58 | Avenir-Book = Avenir-Book 59 | Avenir-BookOblique = Avenir-BookOblique 60 | Avenir-Heavy = Avenir-Heavy 61 | Avenir-HeavyOblique = Avenir-HeavyOblique 62 | Avenir-Light = Avenir-Light 63 | Avenir-LightOblique = Avenir-LightOblique 64 | Avenir-Roman-Bold = Avenir-Medium 65 | Avenir-Roman-Italic = Avenir-Oblique 66 | 67 | #Avenir Next 68 | AvenirNext-Bold = AvenirNext-Bold 69 | AvenirNext-BoldItalic = AvenirNext-BoldItalic 70 | AvenirNext-DemiBold = AvenirNext-DemiBold 71 | AvenirNext-DemiBoldItalic = AvenirNext-DemiBoldItalic 72 | AvenirNext-Heavy = AvenirNext-Heavy 73 | AvenirNext-HeavyItalic = AvenirNext-HeavyItalic 74 | AvenirNext-Italic = AvenirNext-Italic 75 | AvenirNext-Medium = AvenirNext-Medium 76 | AvenirNext-MediumItalic = AvenirNext-MediumItalic 77 | AvenirNext-Regular = AvenirNext-Regular 78 | AvenirNext-UltraLight = AvenirNext-UltraLight 79 | AvenirNext-UltraLightItalic = AvenirNext-UltraLightItalic 80 | 81 | #Avenir Next Condensed 82 | AvenirNextCondensed-Bold = AvenirNextCondensed-Bold 83 | AvenirNextCondensed-BoldItalic = AvenirNextCondensed-BoldItalic 84 | AvenirNextCondensed-DemiBold = AvenirNextCondensed-DemiBold 85 | AvenirNextCondensed-DemiBoldItalic = AvenirNextCondensed-DemiBoldItalic 86 | AvenirNextCondensed-Heavy = AvenirNextCondensed-Heavy 87 | AvenirNextCondensed-HeavyItalic = AvenirNextCondensed-HeavyItalic 88 | AvenirNextCondensed-Italic = AvenirNextCondensed-Italic 89 | AvenirNextCondensed-Medium = AvenirNextCondensed-Medium 90 | AvenirNextCondensed-MediumItalic = AvenirNextCondensed-MediumItalic 91 | AvenirNextCondensed-Regular = AvenirNextCondensed-Regular 92 | AvenirNextCondensed-UltraLight = AvenirNextCondensed-UltraLight 93 | AvenirNextCondensed-UltraLightItalic = AvenirNextCondensed-UltraLightItalic 94 | 95 | #Bangla Sangam MN 96 | #BanglaSangamMN = BanglaSangamMN 97 | BanglaSangamMN-Bold = BanglaSangamMN-Bold 98 | 99 | #Baskerville = Baskerville 100 | Baskerville-Bold = Baskerville-Bold 101 | Baskerville-BoldItalic = Baskerville-BoldItalic 102 | Baskerville-Italic = Baskerville-Italic 103 | Baskerville-SemiBold = Baskerville-SemiBold 104 | Baskerville-SemiBoldItalic = Baskerville-SemiBoldItalic 105 | 106 | #BobbyJ 107 | BobbyJ-Bold = BobbyJ-Bold 108 | BobbyJ = BobbyJ-Regular 109 | BobbyJ-Regular-Bold = BobbyJ-Bold 110 | BobbyJRough-Bd = BobbyJRough-Bd 111 | BobbyJRough-Rg = BobbyJRough-Rg 112 | BobbyJSerif-Bld = BobbyJSerif-Bld 113 | BobbyJSerif = BobbyJSerif-Rg 114 | 115 | #Bodoni Ornaments 116 | #BodoniOrnamentsITCTT = BodoniOrnamentsITCTT 117 | 118 | #Bodoni 72 119 | BodoniSvtyTwoITCTT-Bold = BodoniSvtyTwoITCTT-Bold 120 | BodoniSvtyTwoITCTT-Book = BodoniSvtyTwoITCTT-Book 121 | BodoniSvtyTwoITCTT-BookIta = BodoniSvtyTwoITCTT-BookIta 122 | 123 | #Bodoni 72 Oldstyle 124 | BodoniSvtyTwoOSITCTT-Bold = BodoniSvtyTwoOSITCTT-Bold 125 | BodoniSvtyTwoOSITCTT-Book = BodoniSvtyTwoOSITCTT-Book 126 | BodoniSvtyTwoOSITCTT-BookIt = BodoniSvtyTwoOSITCTT-BookIt 127 | BodoniSvtyTwoSCITCTT-Book = BodoniSvtyTwoSCITCTT-Book 128 | 129 | #Bradley Hand 130 | BradleyHandITCTT-Bold = BradleyHandITCTT-Bold 131 | 132 | #Chalkboard SE 133 | ChalkboardSE-Bold = ChalkboardSE-Bold 134 | ChalkboardSE-Light = ChalkboardSE-Light 135 | ChalkboardSE-Regular = ChalkboardSE-Regular 136 | 137 | #Chalkduster 138 | #Chalkduster = Chalkduster 139 | 140 | #Cochin 141 | #Cochin = Cochin 142 | Cochin-Bold = Cochin-Bold 143 | Cochin-BoldItalic = Cochin-BoldItalic 144 | Cochin-Italic = Cochin-Italic 145 | 146 | #Copperplate 147 | #Copperplate = Copperplate 148 | Copperplate-Bold = Copperplate-Bold 149 | Copperplate-Light = Copperplate-Light 150 | 151 | #Courier 152 | #Courier = Courier 153 | Courier-Bold = Courier-Bold 154 | Courier-BoldOblique = Courier-BoldOblique 155 | Courier-Oblique = Courier-Oblique 156 | 157 | #Courier New 158 | CourierNewPS-BoldItalicMT = CourierNewPS-BoldItalicMT 159 | CourierNewPS-BoldMT = CourierNewPS-BoldMT 160 | CourierNewPS-ItalicMT = CourierNewPS-ItalicMT 161 | #CourierNewPSMT = CourierNewPSMT 162 | 163 | #CrimsonText-Roman 164 | CrimsonText = CrimsonText-Roman 165 | CrimsonText-Bold = CrimsonText-Semibold 166 | CrimsonText-BoldItalic = CrimsonText-SemiboldItalic 167 | CrimsonText-Italic = CrimsonText-Italic 168 | 169 | #DB LCD Temp 170 | #DBLCDTempBlack = DBLCDTempBlack 171 | 172 | #Devanagari Sangam MN 173 | #DevanagariSangamMN = DevanagariSangamMN 174 | DevanagariSangamMN-Bold = DevanagariSangamMN-Bold 175 | 176 | #Didot 177 | #Didot = Didot 178 | Didot-Bold = Didot-Bold 179 | Didot-Italic = Didot-Italic 180 | 181 | #Euphemia UCAS 182 | #EuphemiaUCAS = EuphemiaUCAS 183 | EuphemiaUCAS-Bold = EuphemiaUCAS-Bold 184 | EuphemiaUCAS-Italic = EuphemiaUCAS-Italic 185 | 186 | #Futura 187 | Futura-CondensedExtraBold = Futura-CondensedExtraBold 188 | Futura-CondensedMedium = Futura-CondensedMedium 189 | Futura-Medium = Futura-Medium 190 | Futura-MediumItalic = Futura-MediumItalic 191 | 192 | #Geeza Pro 193 | #GeezaPro = GeezaPro 194 | GeezaPro-Bold = GeezaPro-Bold 195 | 196 | #Georgia 197 | #Georgia = Georgia 198 | Georgia-Bold = Georgia-Bold 199 | Georgia-BoldItalic = Georgia-BoldItalic 200 | Georgia-Italic = Georgia-Italic 201 | 202 | #Gill Sans 203 | #GillSans = GillSans 204 | GillSans-Bold = GillSans-Bold 205 | GillSans-BoldItalic = GillSans-BoldItalic 206 | GillSans-Italic = GillSans-Italic 207 | GillSans-Light = GillSans-Light 208 | GillSans-LightItalic = GillSans-LightItalic 209 | 210 | #Gujarati Sangam MN 211 | #GujaratiSangamMN = GujaratiSangamMN 212 | GujaratiSangamMN-Bold = GujaratiSangamMN-Bold 213 | 214 | #Gurmukhi MN 215 | #GurmukhiMN = GurmukhiMN 216 | GurmukhiMN-Bold = GurmukhiMN-Bold 217 | 218 | #Heiti SC 219 | STHeitiSC-Light = STHeitiSC-Light 220 | STHeitiSC-Medium = STHeitiSC-Medium 221 | 222 | #Heiti TC 223 | STHeitiTC-Light = STHeitiTC-Light 224 | STHeitiTC-Medium = STHeitiTC-Medium 225 | 226 | #Helvetica 227 | #Helvetica = Helvetica 228 | Helvetica-Bold = Helvetica-Bold 229 | Helvetica-BoldOblique = Helvetica-BoldOblique 230 | Helvetica-Light = Helvetica-Light 231 | Helvetica-LightOblique = Helvetica-LightOblique 232 | Helvetica-Oblique = Helvetica-Oblique 233 | 234 | #Helvetica Neue 235 | #HelveticaNeue = HelveticaNeue 236 | HelveticaNeue-Bold = HelveticaNeue-Bold 237 | HelveticaNeue-BoldItalic = HelveticaNeue-BoldItalic 238 | HelveticaNeue-CondensedBlack = HelveticaNeue-CondensedBlack 239 | HelveticaNeue-CondensedBold = HelveticaNeue-CondensedBold 240 | HelveticaNeue-Italic = HelveticaNeue-Italic 241 | HelveticaNeue-Light = HelveticaNeue-Light 242 | HelveticaNeue-LightItalic = HelveticaNeue-LightItalic 243 | HelveticaNeue-Medium = HelveticaNeue-Medium 244 | HelveticaNeue-UltraLight = HelveticaNeue-UltraLight 245 | HelveticaNeue-UltraLightItalic = HelveticaNeue-UltraLightItalic 246 | 247 | #Hiragino Kaku Gothic ProN 248 | HiraKakuProN-W3 = HiraKakuProN-W3 249 | HiraKakuProN-W6 = HiraKakuProN-W6 250 | 251 | #Hiragino Mincho ProN 252 | HiraMinProN-W3 = HiraMinProN-W3 253 | HiraMinProN-W6 = HiraMinProN-W6 254 | 255 | #Hoefler Text 256 | HoeflerText-Black = HoeflerText-Black 257 | HoeflerText-BlackItalic = HoeflerText-BlackItalic 258 | HoeflerText-Italic = HoeflerText-Italic 259 | HoeflerText-Regular = HoeflerText-Regular 260 | 261 | 262 | #JournalBold 263 | JournalBold-Bold = JournalBold 264 | JournalText-Bold = JournalBold 265 | JournalText-Italic = JournalItalic 266 | 267 | #Kailasa 268 | #Kailasa = Kailasa 269 | Kailasa-Bold = Kailasa-Bold 270 | 271 | #Kannada Sangam MN 272 | #KannadaSangamMN = KannadaSangamMN 273 | KannadaSangamMN-Bold = KannadaSangamMN-Bold 274 | 275 | #Malayalam Sangam MN 276 | #MalayalamSangamMN = MalayalamSangamMN 277 | MalayalamSangamMN-Bold = MalayalamSangamMN-Bold 278 | 279 | #Marion 280 | Marion-Bold = Marion-Bold 281 | Marion-Italic = Marion-Italic 282 | Marion-Regular = Marion-Regular 283 | 284 | #Marker Felt 285 | MarkerFelt-Thin = MarkerFelt-Thin 286 | MarkerFelt-Wide = MarkerFelt-Wide 287 | 288 | #Noteworthy 289 | Noteworthy-Bold = Noteworthy-Bold 290 | Noteworthy-Light = Noteworthy-Light 291 | 292 | #Optima 293 | Optima-Bold = Optima-Bold 294 | Optima-BoldItalic = Optima-BoldItalic 295 | Optima-ExtraBlack = Optima-ExtraBlack 296 | Optima-Italic = Optima-Italic 297 | Optima-Regular = Optima-Regular 298 | 299 | #Oriya Sangam MN 300 | #OriyaSangamMN = OriyaSangamMN 301 | OriyaSangamMN-Bold = OriyaSangamMN-Bold 302 | 303 | #Palatino 304 | Palatino-Bold = Palatino-Bold 305 | Palatino-BoldItalic = Palatino-BoldItalic 306 | Palatino-Italic = Palatino-Italic 307 | Palatino-Roman = Palatino-Roman 308 | 309 | #Papyrus 310 | #Papyrus = Papyrus 311 | Papyrus-Condensed = Papyrus-Condensed 312 | 313 | #Party LET 314 | #PartyLetPlain = PartyLetPlain 315 | 316 | #Sinhala Sangam MN 317 | #SinhalaSangamMN = SinhalaSangamMN 318 | SinhalaSangamMN-Bold = SinhalaSangamMN-Bold 319 | 320 | #Snell Roundhand 321 | #SnellRoundhand = SnellRoundhand 322 | SnellRoundhand-Black = SnellRoundhand-Black 323 | SnellRoundhand-Bold = SnellRoundhand-Bold 324 | 325 | #Symbol 326 | #Symbol = Symbol 327 | 328 | #Tamil Sangam MN 329 | #TamilSangamMN = TamilSangamMN 330 | TamilSangamMN-Bold = TamilSangamMN-Bold 331 | 332 | #Telugu Sangam MN 333 | #TeluguSangamMN = TeluguSangamMN 334 | TeluguSangamMN-Bold = TeluguSangamMN-Bold 335 | 336 | #Thonburi 337 | #Thonburi = Thonburi 338 | Thonburi-Bold = Thonburi-Bold 339 | 340 | #Times New Roman 341 | TimesNewRomanPS-BoldItalicMT = TimesNewRomanPS-BoldItalicMT 342 | TimesNewRomanPS-BoldMT = TimesNewRomanPS-BoldMT 343 | TimesNewRomanPS-ItalicMT = TimesNewRomanPS-ItalicMT 344 | #TimesNewRomanPSMT = TimesNewRomanPSMT 345 | 346 | #Trebuchet MS 347 | Trebuchet-BoldItalic = Trebuchet-BoldItalic 348 | #TrebuchetMS = TrebuchetMS 349 | TrebuchetMS-Bold = TrebuchetMS-Bold 350 | TrebuchetMS-Italic = TrebuchetMS-Italic 351 | 352 | #Verdana 353 | #Verdana = Verdana 354 | Verdana-Bold = Verdana-Bold 355 | Verdana-BoldItalic = Verdana-BoldItalic 356 | Verdana-Italic = Verdana-Italic 357 | 358 | #Zapf Dingbats 359 | #ZapfDingbatsITC = ZapfDingbatsITC 360 | 361 | #Zapfino 362 | #Zapfino = Zapfino 363 | 364 | 365 | # 366 | # Custom Fonts 367 | # 368 | 369 | #Crimson Text 370 | #CrimsonText-Roman = CrimsonText-Roman 371 | CrimsonText-Roman-Italic = CrimsonText-Italic 372 | CrimsonText-Roman-Bold = CrimsonText-Bold 373 | CrimsonText-Roman-Bold-Italic = CrimsonText-BoldItalic 374 | 375 | 376 | -------------------------------------------------------------------------------- /examples/scripts/textrender/html.lua: -------------------------------------------------------------------------------- 1 | -- $Id: html.lua,v 1.2 2007-05-12 04:37:20 tclua Exp $ 2 | 3 | module(..., package.seeall) 4 | 5 | local lower = string.lower 6 | 7 | local entities = require ("scripts.textrender.entities") 8 | 9 | 10 | local entity = { 11 | nbsp = " ", 12 | lt = "<", 13 | gt = ">", 14 | quot = "\"", 15 | amp = "&", 16 | } 17 | 18 | -- keep unknown entity as is 19 | setmetatable(entity, { 20 | __index = function (t, key) 21 | return "&" .. key .. ";" 22 | end 23 | }) 24 | 25 | local block = { 26 | "address", 27 | "blockquote", 28 | "center", 29 | "dir", "div", "dl", 30 | "fieldset", "form", 31 | "h1", "h2", "h3", "h4", "h5", "h6", "hr", 32 | "isindex", 33 | "menu", 34 | "noframes", 35 | "ol", 36 | "p", 37 | "pre", 38 | "table", 39 | "ul", 40 | } 41 | 42 | local inline = { 43 | "a", "abbr", "acronym", "applet", 44 | "b", "basefont", "bdo", "big", "br", "button", 45 | "cite", "code", 46 | "dfn", 47 | "em", 48 | "font", 49 | "i", "iframe", "img", "input", 50 | "kbd", 51 | "label", 52 | "map", 53 | "object", 54 | "q", 55 | "s", "samp", "select", "small", "span", "strike", "strong", "sub", "sup", 56 | "textarea", "tt", 57 | "u", 58 | "var", 59 | } 60 | 61 | local tags = { 62 | a = { empty = false }, 63 | abbr = {empty = false} , 64 | acronym = {empty = false} , 65 | address = {empty = false} , 66 | applet = {empty = false} , 67 | area = {empty = true} , 68 | b = {empty = false} , 69 | base = {empty = true} , 70 | basefont = {empty = true} , 71 | bdo = {empty = false} , 72 | big = {empty = false} , 73 | blockquote = {empty = false} , 74 | body = { empty = false, }, 75 | br = {empty = true} , 76 | button = {empty = false} , 77 | caption = {empty = false} , 78 | center = {empty = false} , 79 | cite = {empty = false} , 80 | code = {empty = false} , 81 | col = {empty = true} , 82 | colgroup = { 83 | empty = false, 84 | optional_end = true, 85 | child = {"col",}, 86 | }, 87 | dd = {empty = false} , 88 | del = {empty = false} , 89 | dfn = {empty = false} , 90 | dir = {empty = false} , 91 | div = {empty = false} , 92 | dl = {empty = false} , 93 | dt = { 94 | empty = false, 95 | optional_end = true, 96 | child = { 97 | inline, 98 | "del", 99 | "ins", 100 | "noscript", 101 | "script", 102 | }, 103 | }, 104 | em = {empty = false} , 105 | fieldset = {empty = false} , 106 | font = {empty = false} , 107 | form = {empty = false} , 108 | frame = {empty = true} , 109 | frameset = {empty = false} , 110 | h1 = {empty = false} , 111 | h2 = {empty = false} , 112 | h3 = {empty = false} , 113 | h4 = {empty = false} , 114 | h5 = {empty = false} , 115 | h6 = {empty = false} , 116 | head = {empty = false} , 117 | hr = {empty = true} , 118 | html = {empty = false} , 119 | i = {empty = false} , 120 | iframe = {empty = false} , 121 | img = {empty = true} , 122 | input = {empty = true} , 123 | ins = {empty = false} , 124 | isindex = {empty = true} , 125 | kbd = {empty = false} , 126 | label = {empty = false} , 127 | legend = {empty = false} , 128 | li = { 129 | empty = false, 130 | optional_end = true, 131 | child = { 132 | inline, 133 | block, 134 | "del", 135 | "ins", 136 | "noscript", 137 | "script", 138 | }, 139 | }, 140 | link = {empty = true} , 141 | map = {empty = false} , 142 | menu = {empty = false} , 143 | meta = {empty = true} , 144 | noframes = {empty = false} , 145 | noscript = {empty = false} , 146 | object = {empty = false} , 147 | ol = {empty = false} , 148 | optgroup = {empty = false} , 149 | option = { 150 | empty = false, 151 | optional_end = true, 152 | child = {}, 153 | }, 154 | p = { 155 | empty = false, 156 | optional_end = true, 157 | child = { 158 | inline, 159 | "del", 160 | "ins", 161 | "noscript", 162 | "script", 163 | }, 164 | } , 165 | param = {empty = true} , 166 | pre = {empty = false} , 167 | q = {empty = false} , 168 | s = {empty = false} , 169 | samp = {empty = false} , 170 | script = {empty = false} , 171 | select = {empty = false} , 172 | small = {empty = false} , 173 | span = {empty = false} , 174 | strike = {empty = false} , 175 | strong = {empty = false} , 176 | style = {empty = false} , 177 | sub = {empty = false} , 178 | sup = {empty = false} , 179 | table = {empty = false} , 180 | tbody = {empty = false} , 181 | td = { 182 | empty = false, 183 | optional_end = true, 184 | child = { 185 | inline, 186 | block, 187 | "del", 188 | "ins", 189 | "noscript", 190 | "script", 191 | }, 192 | }, 193 | textarea = {empty = false} , 194 | tfoot = { 195 | empty = false, 196 | optional_end = true, 197 | child = {"tr",}, 198 | }, 199 | th = { 200 | empty = false, 201 | optional_end = true, 202 | child = { 203 | inline, 204 | block, 205 | "del", 206 | "ins", 207 | "noscript", 208 | "script", 209 | }, 210 | }, 211 | thead = { 212 | empty = false, 213 | optional_end = true, 214 | child = {"tr",}, 215 | }, 216 | title = {empty = false} , 217 | tr = { 218 | empty = false, 219 | optional_end = true, 220 | child = { 221 | "td", "th", 222 | }, 223 | }, 224 | tt = {empty = false} , 225 | u = {empty = false} , 226 | ul = {empty = false} , 227 | var = {empty = false} , 228 | } 229 | 230 | setmetatable(tags, { 231 | __index = function (t, key) 232 | return {empty = false} 233 | end 234 | }) 235 | 236 | -- string buffer implementation 237 | function newbuf () 238 | local buf = { 239 | _buf = {}, 240 | clear = function (self) self._buf = {}; return self end, 241 | content = function (self) return table.concat(self._buf) end, 242 | append = function (self, s) 243 | self._buf[#(self._buf) + 1] = s 244 | return self 245 | end, 246 | set = function (self, s) self._buf = {s}; return self end, 247 | } 248 | return buf 249 | end 250 | 251 | -- unescape character entities 252 | function unescape (s) 253 | function entity2string (e) 254 | e = entity[e] 255 | if e:len() > 1 then 256 | e = entities.dec_entity(e) 257 | end 258 | return e 259 | end 260 | return s.gsub(s, "&(#?%w+);", entity2string) 261 | end 262 | 263 | -- iterator factory 264 | function makeiter (f) 265 | local co = coroutine.create(f) 266 | return function () 267 | local code, res = coroutine.resume(co) 268 | return res 269 | end 270 | end 271 | 272 | -- constructors for token 273 | function Tag (s) 274 | return string.find(s, "^" then 303 | coroutine.yield(Tag(buf:append(c):content())) 304 | buf:clear() 305 | return text(f, buf) 306 | elseif c then 307 | buf:append(c) 308 | return tag(f, buf) 309 | else 310 | if buf:content() ~= "" then coroutine.yield(Tag(buf:content())) end 311 | end 312 | end 313 | 314 | function parse_starttag(tag) 315 | local tagname = string.match(tag, "<%s*(%w+)") 316 | local elem = {_attr = {}} 317 | elem._tag = lower(tostring(tagname)) 318 | for key, _, val in string.gmatch(tag, "(%w+)%s*=%s*([\"'])(.-)%2", i) do 319 | local unescaped = unescape(val) 320 | elem._attr[key] = unescaped 321 | end 322 | return elem 323 | end 324 | 325 | function parse_endtag(tag) 326 | local tagname = string.match(tag, "<%s*/%s*(%w+)") 327 | return lower(tostring(tagname)) 328 | end 329 | 330 | -- find last element that satisfies given predicate 331 | function rfind(t, pred) 332 | local length = #t 333 | for i=length,1,-1 do 334 | if pred(t[i]) then 335 | return i, t[i] 336 | end 337 | end 338 | end 339 | 340 | function flatten(t, acc) 341 | acc = acc or {} 342 | for i,v in ipairs(t) do 343 | if type(v) == "table" then 344 | flatten(v, acc) 345 | else 346 | acc[#acc + 1] = v 347 | end 348 | end 349 | return acc 350 | end 351 | 352 | function optional_end_p(elem) 353 | if tags[elem._tag].optional_end then 354 | return true 355 | else 356 | return false 357 | end 358 | end 359 | 360 | function valid_child_p(child, parent) 361 | local schema = tags[parent._tag].child 362 | if not schema then return true end 363 | 364 | for i,v in ipairs(flatten(schema)) do 365 | if v == child._tag then 366 | return true 367 | end 368 | end 369 | 370 | return false 371 | end 372 | 373 | -- tree builder 374 | function parse(f) 375 | local root = {_tag = "#document", _attr = {}} 376 | local stack = {root} 377 | for i in makeiter(function () return text(f, newbuf()) end) do 378 | if i.type == "Start" then 379 | local new = parse_starttag(i.value) 380 | local top = stack[#stack] 381 | 382 | while 383 | top._tag ~= "#document" and 384 | optional_end_p(top) and 385 | not valid_child_p(new, top) 386 | do 387 | stack[#stack] = nil 388 | top = stack[#stack] 389 | end 390 | 391 | top[#top+1] = new -- appendchild 392 | if not tags[new._tag].empty then 393 | stack[#stack+1] = new -- push 394 | end 395 | elseif i.type == "End" then 396 | local tag = parse_endtag(i.value) 397 | local openingpos = rfind(stack, function(v) 398 | if v._tag == tag then 399 | return true 400 | else 401 | return false 402 | end 403 | end) 404 | if openingpos then 405 | local length = #stack 406 | for j=length,openingpos,-1 do 407 | table.remove(stack, j) 408 | end 409 | end 410 | else -- Text 411 | local top = stack[#stack] 412 | top[#top+1] = i.value 413 | end 414 | end 415 | return root 416 | end 417 | 418 | function parsestr(s) 419 | local handle = { 420 | _content = s, 421 | _pos = 1, 422 | read = function (self, length) 423 | if self._pos > string.len(self._content) then return end 424 | local ret = string.sub(self._content, self._pos, self._pos + length - 1) 425 | self._pos = self._pos + length 426 | return ret 427 | end 428 | } 429 | return parse(handle) 430 | end -------------------------------------------------------------------------------- /examples/scripts/textrender/textstyles-rgb.txt: -------------------------------------------------------------------------------- 1 | # style = font, size, leading, R,G,B, width, opacity, NORMAL|ALL_CAPS, text alignment, spaceBefore, spaceAfter, firstLineIndent, leftIndent, rightIndent 2 | 3 | #generic styles 4 | Normal = Avenir-Book,16,20,0,0,0,,100% 5 | Heading = Avenir-Bold,16,20,20,255,20,,100% 6 | Title=Avenir-Light,24,40,180,180,180,,100%,NORMAL,left,10,6,0,0,0 7 | H1=,18,26,0,0,0,,100%,NORMAL,left,12,4,0,0,0 8 | H2=Avenir-Book,18,26,0,0,0,,100%,NORMAL,left,12,4,0,0,0 9 | H2 Light=Avenir-Book,18,26,220,220,220,,100%,NORMAL,left,12,4,0,0,0 10 | H3=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 11 | H4=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 12 | H6=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 13 | H5=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 14 | Quote = Avenir-Light,20,28,200,255,20,,100% 15 | 16 | # styles for the library 17 | eventListRowTime=AvenirNextCondensed-Medium,16,16,80,120,120,,100%,NORMAL,right,0,-20,0,0,0 18 | eventListRowTitle=AvenirNext-Medium,20,26,0,0,0,,100%,NORMAL,left,0,30,0,0,0 19 | eventListRowAuthor=Avenir-Light,14,14,160,160,160,,100%,NORMAL,left,0,14,0,0,0 20 | eventListRowDate=Avenir-Light,16,20,0,0,0,,100%,NORMAL,left,0,0,0,0,0 21 | eventListRowBody=Avenir-Book,14,22,100,100,100,,100%,NORMAL,left,0,0,0,0,0 22 | 23 | eventPageTitle=AvenirNext-Medium,36,40,0,0,0,,100%,NORMAL,left,0,20,0,0,0 24 | eventPageAuthor=Avenir-Light,18,22,0,0,0,,100%,NORMAL,left,0,10,0,0,0 25 | eventPageDate=Avenir-Light,16,20,0,0,0,,100%,NORMAL,left,0,10,0,0,0 26 | eventPageBody=Avenir-Light,16,24,0,0,0,,100%,NORMAL,left,0,0,0,0,0 27 | 28 | # styles for the settings screen 29 | settingsTitle=Avenir-Heavy,24,30,100,100,100,,100%,NORMAL,center,0,0,0,0,0 30 | settingsBody=Avenir-Light,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 31 | settingsLabel=Avenir-Medium,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 32 | 33 | # styles for captions 34 | caption=Avenir-Book,14,24,0,0,0,,100%,NORMAL,left,0,14,0,0,0 35 | caption-title=Avenir-Book,14,24,0,0,0,,100%,NORMAL,left,0,14,0,0,0 36 | 37 | #styles for table of contents 38 | contents-item = Avenir-Light,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 39 | 40 | # styles for the dialog screen 41 | dialogTitle=Avenir-Heavy,24,30,100,100,100,,100%,NORMAL,center,0,0,0,0,0 42 | dialogBody=Avenir-Light,16,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 43 | dialogLabel=Avenir-Medium,16,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 44 | dialogDescription=Avenir-Medium,16,20,100,100,120,,100%,NORMAL,left,0,12,0,0,0 45 | dialogLargeDescription=Avenir-Medium,18,24,60,60,60,,100%,NORMAL,left,0,12,0,0,0 46 | 47 | # testing styles 48 | Left = Baskerville,16,24, 0,0,0,,100%,NORMAL, left,0,0,0,0,0 49 | Right = Baskerville,16,24,0,0,0,,100%,NORMAL,right,0,0,0,0,0 50 | Center = Baskerville,16,24,0,0,0,,100%,NORMAL,center,0,0,0,0,0 51 | -------------------------------------------------------------------------------- /examples/scripts/textrender/textstyles.txt: -------------------------------------------------------------------------------- 1 | # SAMPLE TEXT STYLES FOR CORONA GRAPHICS v2 (values between 0-1) 2 | 3 | # style = font, size, leading, R,G,B, width, opacity, NORMAL|ALL_CAPS, text alignment, spaceBefore, spaceAfter, firstLineIndent, leftIndent, rightIndent 4 | 5 | # default paragraph style 6 | body = Avenir-Roman ,16,20,0,0,0,,100%, none, left,0,0,0,0,0 7 | 8 | # hyperlink color (blue) 9 | a = ,,,0,0,255,,100% 10 | 11 | # common styles 12 | Heading = Avenir-Black,16,20,0,0,0,,100%,,left,0,0,0,0,0 13 | Title=Avenir-Black,24,40,0.5,0.5,0.5,,100%,,left,20,0,0,0,0 14 | 15 | H1=Avenir-Black ,24,26,0,0,0,,100%,,left,12,24,0,0,0 16 | H2=Avenir-Black ,20,26,0,0,0,,100%,,left,12,12,0,0,0 17 | H3=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 18 | H4=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 19 | H6=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 20 | H5=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 21 | 22 | Quote = Avenir-Roman ,20,28,200,255,20,,100% 23 | 24 | hr = ,,,,,,,,, left,2,2,0,0,0 25 | 26 | # Default settings for hanging text in lists 27 | li = ,12,,,,,,,, left,0,0,-30,30,0 28 | ol = ,,,,,,,,, left,0,0,0,0,0 29 | 30 | # styles for the library 31 | eventListRowTime=AvenirNextCondensed-Medium,16,16,0.5,0.5,0.5,,100%,NORMAL,right,0,-20,0,0,0 32 | eventListRowTitle=AvenirNext-Medium,20,26,0,0,0,,100%,NORMAL,left,0,30,0,0,0 33 | eventListRowAuthor=Avenir-Light,14,14,.5,.5,.5,,100%,NORMAL,left,0,14,0,0,0 34 | eventListRowDate=Avenir-Light,16,20,0,0,0,,100%,NORMAL,left,0,0,0,0,0 35 | eventListRowBody=Avenir-Book,14,22,100,100,100,,100%,NORMAL,left,0,0,0,0,0 36 | 37 | eventPageTitle=AvenirNext-Medium,36,40,0,0,0,,100%,NORMAL,left,0,20,0,0,0 38 | eventPageAuthor=Avenir-Light,18,22,0,0,0,,100%,NORMAL,left,0,10,0,0,0 39 | eventPageDate=Avenir-Light,16,20,0,0,0,,100%,NORMAL,left,0,10,0,0,0 40 | eventPageBody=Avenir-Light,16,24,0,0,0,,100%,NORMAL,left,0,0,0,0,0 41 | 42 | # styles for the settings screen 43 | settingsTitle=Avenir-Heavy,24,30,100,100,100,,100%,NORMAL,center,0,0,0,0,0 44 | settingsBody=Avenir-Light,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 45 | settingsLabel=Avenir-Medium,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 46 | 47 | # styles for captions 48 | caption=Avenir-Book,14,24,0,0,0,,100%,NORMAL,left,0,14,0,0,0 49 | caption-title=Avenir-Book,14,24,0,0,0,,100%,NORMAL,left,0,14,0,0,0 50 | 51 | #styles for table of contents 52 | contents-item = Avenir-Light,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 53 | 54 | # styles for the dialog screen 55 | dialogTitle=Avenir-Heavy,24,30,.4,.4,.4,,100%,NORMAL,center,0,0,0,0,0 56 | dialogBody=Avenir-Light,16,24,.25,.25,.25,,100%,NORMAL,left,0,24,0,0,0 57 | dialogLabel=Avenir-Medium,16,24,.25,.25,.25,,100%,NORMAL,left,0,24,0,0,0 58 | dialogDescription=Avenir-Medium,16,20,0.5,0.5,0.5,,100%,NORMAL,left,0,12,0,0,0 59 | dialogLargeDescription=Avenir-Medium,18,24,.25,.25,.25,,100%,NORMAL,left,0,12,0,0,0 60 | 61 | # testing styles 62 | LeftIndent = Baskerville,16,24, 0,0,0,,100%,NORMAL, left,0,0,20,0,0 63 | Left = Baskerville,16,24, 0,0,0,,100%,NORMAL, left,0,0,0,0,0 64 | Right = Baskerville,16,24,0,0,0,,100%,NORMAL,right,0,0,0,0,0 65 | Center = Baskerville,16,24,0,0,0,,100%,NORMAL,center,0,0,0,0,0 66 | -------------------------------------------------------------------------------- /fontmetrics.lua: -------------------------------------------------------------------------------- 1 | -- fontmetrics.lua 2 | -- 3 | -- Version 0.3 4 | -- 5 | -- Copyright (C) 2011 David I. Gross. All Rights Reserved. 6 | -- 7 | --[[ 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | this software and associated documentation files (the "Software"), to deal in the 10 | Software without restriction, including without limitation the rights to use, copy, 11 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, subject to the 13 | following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all copies 16 | or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 19 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 20 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 21 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 22 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | --]] 25 | 26 | -- 27 | -- =================== 28 | -- FONT METRICS FUNCTIONS 29 | -- =================== 30 | 31 | --[[ 32 | 33 | Return font metrics that tell how to position a font correctly. 34 | 35 | Font metrics for 72pt Baskerville "A" are: 36 | 37 | characterWidth = 72 38 | characterHeight = 72 39 | ascender = 64 40 | descender = -18 41 | textWidth = 50.953125 42 | textHeight = 81 43 | maxHorizontalAdvance = 84 44 | boundingBox = Array 45 | originX = 49 46 | originY = 0 47 | 48 | 49 | 50 | The metrics file is a list of font names and values. 51 | 52 | Format of the source file: 53 | name = characterWidth, characterHeight, ascender, descender, textWidth, textHeight, maxHorizontalAdvance, originX, originY 54 | 55 | 56 | baseline : is the distance from the very top of the font to the baseline, as rendered by Corona, as a percentage of the requested font size. So, for a 300px font, if the baseline is 1.0, then the baseline of the font is at 300px from the top of the font (right where it should be) 57 | 58 | capheight : the height of a capital "X", as a percentage of the size. So, for a 300px font, if the capheight is 0.65, then the "X" of the 300px font is 0.65 * 300 = 195px. 59 | 60 | e.g. 61 | CrimsonText-Roman=1.0, 0.65 62 | 63 | 64 | This returns a metrics table, which has the baseline, capheight, ascent, and height 65 | 66 | baseline: see above 67 | capheight: see above 68 | ascent: baseline - capheight 69 | height: the percentage of the requested size, e.g. 300px, that the text really is. Ask for 300px of 70 | font X, and you might get something 400px high. Use : height * size = real size, e.g. if height 71 | of the font at 300px really is 400px, then the value will be 1.33, and 1.33 x 300 = 400px 72 | 73 | ]] 74 | 75 | local FM = {} 76 | 77 | local funx = require ("scripts.funx") 78 | 79 | local function loadMetricsFromFile (metricsfile, fontfacesfile, path) 80 | local metricsPacked = {} 81 | local variations = {} 82 | 83 | metricsfile = metricsfile or "scripts/textrender/fontmetrics.txt" 84 | 85 | local metrics = { variations = {}, } 86 | 87 | if (metricsfile) then 88 | path = path or system.SystemDirectory 89 | local filePath = system.pathForFile( metricsfile, path ) 90 | metricsPacked = funx.loadTableFromFile(filePath, "\n") 91 | else 92 | return metrics 93 | end 94 | 95 | 96 | if (not metricsPacked) then 97 | return metrics 98 | end 99 | 100 | local x = 0 101 | for n,v in pairs(metricsPacked) do 102 | 103 | local vv = funx.split(v,",") 104 | 105 | --[[ 106 | 107 | # fontname = sampledFontSize, characterWidth, characterHeight, ascender, descender, textWidth, textHeight, maxHorizontalAdvance, originX, originY, boundingBoxX1, boundingBoxY1, boundingBoxX2, boundingBoxY2 108 | 109 | The 26.6 fixed float format used to define fractional pixel coordinates. Here, 1 unit = 1/64 pixel. 110 | 111 | Bounding Box: xMin, yMin, xMax, yMax 112 | xMin 113 | The horizontal minimum (left-most). 114 | 115 | yMin 116 | The vertical minimum (bottom-most). 117 | 118 | xMax 119 | The horizontal maximum (right-most). 120 | 121 | yMax 122 | The vertical maximum (top-most). 123 | 124 | The bounding box is specified with the coordinates of the lower left and the upper right corner. In PostScript, those values are often called (llx,lly) and (urx,ury), respectively. 125 | 126 | If ‘yMin’ is negative, this value gives the glyph's descender. Otherwise, the glyph doesn't descend below the baseline. Similarly, if ‘ymax’ is positive, this value gives the glyph's ascender. 127 | 128 | ‘xMin’ gives the horizontal distance from the glyph's origin to the left edge of the glyph's bounding box. If ‘xMin’ is negative, the glyph extends to the left of the origin. 129 | 130 | --]] 131 | 132 | -- table.remove takes from the end (i.e. "pop") 133 | local y2 = tonumber(table.remove(vv) ) 134 | local x2 = tonumber(table.remove(vv) ) 135 | local y1 = tonumber(table.remove(vv) ) 136 | local x1 = tonumber(table.remove(vv) ) 137 | 138 | local originY = tonumber(table.remove(vv) ) 139 | local originX = tonumber(table.remove(vv) ) 140 | local maxHorizontalAdvance = tonumber(table.remove(vv) ) 141 | local textHeight = tonumber(table.remove(vv) ) 142 | local textWidth = tonumber(table.remove(vv) ) 143 | local descender = tonumber(table.remove(vv) ) 144 | local ascender = tonumber(table.remove(vv) ) 145 | local characterHeight = tonumber(table.remove(vv) ) 146 | local characterWidth = tonumber(table.remove(vv) ) 147 | local sampledFontSize = tonumber(table.remove(vv) ) 148 | 149 | local baseline = descender/sampledFontSize 150 | local capheight = (y2-y1)/sampledFontSize 151 | 152 | metrics[n] = { 153 | capheight = capheight, 154 | baseline = baseline, 155 | ascent = ascender/sampledFontSize, 156 | textHeight = textHeight/sampledFontSize, 157 | descent = descender/sampledFontSize, 158 | maxCharWidth = maxHorizontalAdvance/sampledFontSize, 159 | 160 | originY = originY, 161 | originX = originX, 162 | maxHorizontalAdvance = maxHorizontalAdvance, 163 | textHeight = textHeight, 164 | textWidth = textWidth, 165 | descender = descender, 166 | ascender = ascender, 167 | characterHeight = characterHeight, 168 | characterWidth = characterWidth, 169 | sampledFontSize = sampledFontSize, 170 | 171 | x1 = x1, 172 | y1 = y1, 173 | x2 = x2, 174 | y2 = y2, 175 | 176 | } 177 | end 178 | --funx.dump(metrics) 179 | 180 | 181 | ------------ 182 | -- Get font transformation names, e.g. myfont-italic 183 | fontfacesfile = fontfacesfile or "scripts/textrender/fontvariations.txt" 184 | 185 | if (fontfacesfile) then 186 | path = path or system.SystemDirectory 187 | local filePath = system.pathForFile( fontfacesfile, path ) 188 | variations = funx.loadTableFromFile(filePath, "\n") 189 | end 190 | metrics.variations = variations 191 | 192 | 193 | return metrics 194 | end 195 | 196 | 197 | --------------- 198 | -- Return a font metrics object 199 | function FM.new(metricsfile, fontfacesfile) 200 | local M = {} 201 | 202 | metricsfile = metricsfile or "scripts/textrender/fontmetrics.txt" 203 | fontfacesfile = fontfacesfile or "scripts/textrender/fontvariations.txt" 204 | local metrics = loadMetricsFromFile(metricsfile, fontfacesfile) 205 | 206 | M.metrics = metrics 207 | 208 | 209 | -- Get the metrics for a font. 210 | -- If we don't know, guess. 211 | function M.getMetrics(f) 212 | local fontInfo = {} 213 | fontInfo = metrics[f] 214 | if (not fontInfo) then 215 | print ("WARNING: fontmetrics doesn't have info about the font, '"..tostring(f).."', using Baskerville settings.") 216 | -- unknown font 217 | fontInfo = { 218 | x1=-2.953125, 219 | x2=47.109375, 220 | y1=0.609375, 221 | y2=49, 222 | textHeight=81, 223 | characterWidth=72, 224 | descent=-0.25, 225 | originY=0, 226 | ascent=0.88888888888889, 227 | sampledFontSize=72, 228 | ascender=64, 229 | baseline=-0.25, 230 | originX=49, 231 | characterHeight=72, 232 | textWidth=50.953125, 233 | maxCharWidth=1.1666666666667, 234 | maxHorizontalAdvance=84, 235 | descender=-18, 236 | capheight=0.67209201388889, 237 | } 238 | if (type(f) ~= "string") then 239 | print ("WARNING: fontmetrics was sent a font value that was not a name, probably a .user value.") 240 | end 241 | end 242 | return fontInfo 243 | end 244 | ---------- 245 | 246 | --funx.dump(metrics) 247 | 248 | 249 | return M 250 | end -- new 251 | 252 | return FM -------------------------------------------------------------------------------- /fontmetrics.txt: -------------------------------------------------------------------------------- 1 | ### fontname = sampledFontSize, characterWidth, characterHeight, ascender, descender, textWidth, textHeight, maxHorizontalAdvance, originX, originY, BoundingBox.x1, BoundingBox.y1, BoundingBox.x2, BoundingBox.y2 2 | 3 | APHont-BoldItalic_q15c = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 4 | APHont-Bold_q15c = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 5 | APHont-Italic_q15c = 72, 72, 72, 55, -22, 0, 79, 109, 0, 0, 0, -0.34375, 0.515625, 0.515625 6 | APHont-Regular_q15c = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 7 | 8 | APHont-BoldItalic = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 9 | APHont-Bold = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 10 | APHont-Italic = 72, 72, 72, 55, -22, 0, 79, 109, 0, 0, 0, -0.34375, 0.515625, 0.515625 11 | APHont = 72, 72, 72, 55, -22, 0, 79, 110, 0, 0, 0, -0.34375, 0.515625, 0.515625 12 | 13 | #ASafePlacetoFall = 72, 72, 72, 99, -50, 1, 149, 74, 0, 0, 0, -30, 45, 60 14 | ### the ascender as written in the file is off compared to how it draws: 15 | ASafePlacetoFall = 72, 72, 72, 158, -50, 1, 149, 74, 0, 0, 0, -0.78125, 0.765625, 0.765625 16 | 17 | AmericanTypewriter = 72, 72, 72, 66, -18, 48, 83, 135, 48, 0, 0, -0.28125, 43, 63.5 18 | 19 | Apple Symbols = 72, 72, 72, 48, -18, 38.21875, 72, 225, 37, 0, 0.78125, 0, 36.390625, 39.421875 20 | AppleSDGothicNeo-Bold = 72, 72, 72, 65, -22, 50, 86, 97, 50, 0, 1, 3.25, 50, 56 21 | AppleSDGothicNeo-Regular = 72, 72, 72, 65, -22, 48, 86, 94, 48, 0, 1, 3.671875, 47, 55 22 | 23 | ArchitectsDaughter = 72, 72, 72, 87, -38, 3, 126, 109, 0, 0, 0, -0.59375, 0.765625, 0.765625 24 | 25 | Arbitrary = 72, 72, 72, 52, 15, 35, 36, 84, 36, 0, 0, 0, 34.5, 72 26 | ArbitraryBold = 72, 72, 72, 72, -16, 35, 87, 83, 36, 0, 0, -0.25, 34.5, 72.546875 27 | 28 | AvenirNext Condensed = 72, 72, 72, 72, -27, 39, 98, 70, 38, 0, 0, 0, 38.390625, 51 29 | AvenirNext = 72, 72, 72, 72, -27, 53.984375, 98, 90, 51, 0, -0.984375, 0, 52.421875, 50.875 30 | AvenirNext-Medium = 72, 72, 72, 72, -27, 53.984375, 98, 90, 51, 0, -0.984375, 0, 52.421875, 50.875 31 | Avenir = 72, 72, 72, 72, -27, 50, 98, 72, 49, 0, 0, 0, 49.390625, 51.625 32 | 33 | AvenirNext-DemiBoldItalic = 72, 72, 72, 72, -27, 54.265625, 98, 86, 48, 0, -6.265625, 0, 44.859375, 52.046875 34 | AvenirNext-DemiBold = 72, 72, 72, 72, -27, 52.578125, 98, 89, 51, 0, -0.578125, 0, 51.40625, 51.9375 35 | AvenirNext-Bold = 72, 72, 72, 72, -27, 52.578125, 98, 89, 51, 0, -0.578125, 0, 51.40625, 51.9375 36 | AvenirNext-HeavyItalic = 72, 72, 72, 72, -27, 60.859375, 98, 91, 55, 0, -5.859375, 0, 50.796875, 51.609375 37 | AvenirNext-Heavy = 72, 72, 72, 72, -27, 57.125, 98, 91, 55, 0, -1.125, 0, 55.890625, 50.15625 38 | AvenirNext-Italic = 72, 72, 72, 72, -27, 53.671875, 98, 72, 50, 0, -3.671875, 0, 44.78125, 52.25 39 | AvenirNext-BoldItalic = 72, 72, 72, 72, -27, 53.671875, 98, 72, 50, 0, -3.671875, 0, 44.78125, 52.25 40 | AvenirNext-MediumItalic = 72, 72, 72, 72, -27, 49.796875, 98, 75, 48, 0, -4.796875, 1, 44.03125, 51.125 41 | AvenirNext-Medium = 72, 72, 72, 72, -27, 49.640625, 98, 75, 50, 0, 0.359375, 1, 49.8125, 51.125 42 | AvenirNext-Regular = 72, 72, 72, 72, -27, 49.28125, 98, 72, 50, 0, 0.71875, 0, 49.6875, 52.25 43 | AvenirNext-UltraLightItalic = 72, 72, 72, 72, -27, 47.609375, 98, 72, 45, 0, -2.609375, -0.265625, 40.71875, 50.96875 44 | AvenirNext-UltraLight = 72, 72, 72, 72, -27, 45.734375, 98, 73, 47, 0, 1.265625, -0.265625, 45.71875, 50.96875 45 | 46 | 47 | Avenir-Black = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 48 | Avenir-BlackOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 49 | Avenir-Book = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 50 | Avenir-BookOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 51 | Avenir-Heavy = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 52 | Avenir-HeavyOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 53 | Avenir-Light = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 54 | Avenir-LightOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 55 | Avenir-Medium = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 56 | Avenir-MediumOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 57 | Avenir-Oblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 58 | Avenir-Roman = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 59 | 60 | Baskerville = 72, 72, 72, 65, -18, 49, 82, 72, 49, 0, 0, -0.625, 49, 48 61 | Baskerville-Bold = 72, 72, 72, 65, -19, 49, 83, 84, 47, 0, -1, 0.125, 48, 49 62 | Baskerville-BoldItalic = 72, 72, 72, 64, -18, 50.953125, 81, 84, 49, 0, -2.953125, 0.609375, 47.109375, 49 63 | Baskerville-Italic = 72, 72, 72, 64, -18, 44.34375, 81, 72, 41, 0, -5.34375, 0, 38.046875, 49 64 | Baskerville-SemiBold = 72, 72, 72, 65, -18, 49, 82, 80, 50, 0, 1, 0, 49, 49 65 | Baskerville-SemiBoldItalic = 72, 72, 72, 65, -18, 48.421875, 83, 74, 44, 0, -5.421875, 0.03125, 43, 49 66 | 67 | ### Fixed the ascender from 54 -> 72: 68 | BobbyJ-Regular = 72, 72, 72, 72, -18, 3, 72, 45, 0, 0, 0, -0.28125, 0.5625, 0.5625 69 | ### changed ascender to 88 from 72 for proper centering 70 | BobbyJ-Bold = 72, 72, 72, 88, -18, 3, 73, 45, 0, 0, 0, -0.28125, 0.5625, 0.5625 71 | ### original value: 72 | ### BobbyJ-Bold = 72, 72, 72, 72, -18, 3, 73, 45, 0, 0, 0, -0.28125, 0.5625, 0.5625 73 | BobbyJRough-Bd = 72, 72, 72, 72, -18, 3, 73, 46, 0, 0, 0, -0.28125, 0.5625, 0.5625 74 | BobbyJRough-Rg = 72, 72, 72, 72, -18, 3, 73, 45, 0, 0, 0, -0.28125, 0.5625, 0.5625 75 | BobbyJSerif-Bld = 72, 72, 72, 72, -18, 3, 73, 50, 0, 0, 0, -0.28125, 0.5625, 0.5625 76 | BobbyJSerif-Rg = 72, 72, 72, 72, -18, 3, 73, 46, 0, 0, 0, -0.28125, 0.5625, 0.5625 77 | 78 | BodoniOrnamentsITCTT = 72, 72, 72, 72, -14.4, 42, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 79 | 80 | Courier = 72, 72, 72, 55, -18, 43, 72, 59, 43, 0, 0, 0, 43, 41 81 | CrimsonText-Bold = 72, 72, 72, 78, -52, 51, 136, 89, 50, 0, 1, 0, 50, 46 82 | CrimsonText-Italic = 72, 72, 72, 64, -19, 42.859375, 89, 80, 43, 0, 0.140625, 0, 42.609375, 48 83 | CrimsonText-Roman = 72, 72, 72, 73, -21, 46, 100, 79, 47, 0, 1, 0, 46, 47 84 | CrimsonText-Semibold = 72, 72, 72, 74, -18, 53, 98, 84, 51, 0, 2, 0, 49, 47 85 | CrimsonText-Semibold = 72, 72, 72, 74, -18, 53, 98, 84, 51, 0, 2, 0, 49, 47 86 | CrimsonText-SemiboldItalic = 72, 72, 72, 74, -18, 47.828125, 97, 85, 45, 0, -0.828125, -0.203125, 42.65625, 47 87 | Futura = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 88 | Futura-Bold = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 89 | Futura-BoldOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 90 | Futura-Book t1 = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 91 | Futura-Book t1 2 = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 92 | Futura-BookOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 93 | Futura-Condensed = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 94 | Futura-CondensedBold = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 95 | Futura-CondensedBoldOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 96 | Futura-CondensedExtraBold = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 97 | Futura-CondensedLight t1 = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 98 | Futura-CondensedLight t1 2 = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 99 | Futura-CondensedLightOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 100 | Futura-CondensedOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 101 | Futura-CondExtraBoldObl = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 102 | Futura-ExtraBold = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 103 | Futura-ExtraBoldOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 104 | Futura-Heavy = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 105 | Futura-HeavyOblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 106 | Futura-Light = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 107 | Futura-Medium = 72, 72, 72, 60, -13, 52, 86, 82, 51, 0, -1, 0, 51, 57.109375 108 | Futura-MediumItalic = 72, 72, 72, 60, -13, 52, 86, 82, 51, 0, -1, 0, 51, 57.109375 109 | Futura-Oblique = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 110 | Geeza Pro = 72, 72, 72, 65, -24, 33, 98, 467, 33, 0, 5, 7, 27.625, 51.59375 111 | Geeza Pro Bold = 72, 72, 72, 65, -24, 33, 98, 467, 33, 0, 5, 7, 27.625, 51.59375 112 | Geneva = 72, 72, 72, 72, -18, 51.9375, 96, 124, 51, 0, 1.0625, 0, 50.234375, 54.203125 113 | Georgia = 72, 72, 72, 67, -16, 51, 82, 132, 48, 0, -1, 0, 50, 51.484375 114 | Georgia-Bold = 72, 72, 72, 67, -16, 58, 82, 151, 54, 0, -2, 0, 56, 50.515625 115 | Georgia-Bold-Italic = 72, 72, 72, 67, -16, 60.125, 82, 152, 55, 0, -6.125, 0, 53.015625, 51.03125 116 | Georgia-Italic = 72, 72, 72, 67, -16, 51.515625, 82, 132, 47, 0, -5.515625, 0, 45.375, 49.9375 117 | 118 | Helvetica = 72, 72, 72, 56, -17, 46.9375, 72, 108, 48, 0, 1.0625, 0, 47.140625, 52 119 | 120 | HelveticaNeue = 72, 72, 72, 69, -16, 47.421875, 86, 83, 46, 0, -0.421875, 0, 46.28125, 51 121 | HelveticaNeue-Bold = 72, 72, 72, 71, -16, 49.421875, 88, 83, 48, 0, -0.421875, 0, 48.828125, 51 122 | HelveticaNeue-BoldItalic = 72, 72, 72, 71, -16, 53.359375, 88, 81, 48, 0, -5.359375, -0.375, 44.09375, 51 123 | HelveticaNeue-CondensedBlack = 72, 72, 72, 70, -17, 41.71875, 88, 80, 40, 0, -0.71875, -0.015625, 40.96875, 51.359375 124 | HelveticaNeue-CondensedBold = 72, 72, 72, 70, -16, 41, 87, 79, 40, 0, 0, 0, 40.03125, 52.25 125 | HelveticaNeue-Italic = 72, 72, 72, 69, -16, 50.8125, 86, 77, 47, 0, -3.8125, 0, 42.90625, 51 126 | HelveticaNeue-Light = 72, 72, 72, 70, -16, 45.421875, 87, 80, 44, 0, -0.421875, 0, 44.953125, 51 127 | HelveticaNeue-LightItalic = 72, 72, 72, 69, -16, 49.21875, 86, 76, 44, 0, -5.21875, 0, 39.9375, 51 128 | HelveticaNeue-UltraLight = 72, 72, 72, 68, -16, 43.796875, 84, 75, 41, 0, -0.796875, 0, 42.1875, 52 129 | HelveticaNeue-UltraLightItalic = 72, 72, 72, 67, -16, 46.46875, 84, 75, 41, 0, -5.46875, 0, 37.578125, 52 130 | 131 | HollywoodDecoSG-Medium = 72, 72, 72, 68, -14, 40.703125, 81, 85, 42, 0, 1.296875, 0, 41.046875, 55.046875 132 | HollywoodDecoSG-Medium = 72, 72, 72, 68, -14, 40.703125, 81, 85, 42, 0, 1.296875, 0, 41.046875, 55.046875 133 | 134 | JournalBold = 72, 72, 72, 54, -19, 0, 73, 101, 0, 0, 0, -0.296875, 0.546875, 0.546875 135 | JournalDingbatsTenSSK = 72, 72, 72, 65, -9, 2, 73, 113, 0, 0, 0, -0.140625, 0.875, 0.875 136 | JournalItalic = 72, 72, 72, 54, -19, 0, 73, 79, 0, 0, 0, -0.296875, 0.546875, 0.546875 137 | JournalText = 72, 72, 72, 54, -19, 0, 73, 80, 0, 0, 0, -0.296875, 0.546875, 0.546875 138 | JournalTextFractions = 72, 72, 72, 36, 0, 0, 36, 87, 0, 0, 0, 0, 0.5625, 0.5625 139 | JournalUltraSmallcaps = 72, 72, 72, 55, -19, 0, 73, 99, 0, 0, 0, -0.296875, 0.5625, 0.5625 140 | JournalUltra_Medium = 72, 72, 72, 55, -19, 0, 73, 102, 0, 0, 0, -0.296875, 0.5625, 0.5625 141 | Journal_Bold_Oblique = 72, 72, 72, 63, -23, 0, 85, 43, 0, 0, 0, -0.359375, 0.625, 0.625 142 | 143 | LucidaGrande = 72, 72, 72, 70, -16, 48.421875, 85, 118, 49, 0, 0.578125, 0, 47.890625, 51.3125 144 | 145 | LoveYaLikeASister = 72, 72, 72, 92, -33, 3, 125, 110, 0, 0, 0, -0.515625, 0.921875, 0.921875 146 | LoveYaLikeASisterSolid = 72, 72, 72, 92, -33, 3, 124, 110, 0, 0, 0, -0.515625, 0.921875, 0.921875 147 | 148 | Noteworthy-Light = 72, 72, 72, 93, -24, 0, 116, 96, 0, 0, 0, -0.375, 1.078125, 1.078125 149 | Noteworthy-Bold = 72, 72, 72, 93, -24, 0, 116, 107, 0, 0, 0, -0.375, 1.078125, 1.078125 150 | 151 | MarkerFelt = 72, 72, 72, 63, -16, 44, 78, 83, 45, 0, 2, -2, 43, 59 152 | Menlo = 72, 72, 72, 67, -17, 40.71875, 84, 43, 42, 0, 1.28125, 0, 41.203125, 52.28125 153 | Monaco = 72, 72, 72, 72, -18, 42.859375, 96, 44, 42, 0, 1.140625, 0, 41.234375, 54.203125 154 | Montserrat-Bold = 72, 72, 72, 70, -19, 58.359375, 88, 80, 53, 0, -0.359375, 0, 52.921875, 50.296875 155 | Montserrat-Regular = 72, 72, 72, 70, -19, 58, 88, 84, 53, 0, 0, 0, 53.421875, 50.125 156 | 157 | Noteworthy = 72, 72, 72, 93, -24, 45, 116, 96, 46, 0, 1, -3, 45, 61 158 | OriyaMN = 72, 72, 72, 65, -21, 48.828125, 87, 82, 49, 0, 0.171875, 0, 48.875, 50.765625 159 | Symbol = 72, 72, 72, 51, -22, 27, 72, 75, 32, 0, 4, -1, 27.578125, 49 160 | 161 | TalkingtotheMoon = 72, 72, 72, 72, -37, 1, 109, 62, 0, 0, 0, -0.578125, 0.546875, 0.546875 162 | 163 | TechnoRegular = 72, 72, 72, 72, -14.4, 50, 82.944, 72, 0, 0, 0, -14.4, 57.6, 57.6 164 | Thonburi = 72, 72, 72, 78, -17, 51.921875, 99, 105, 51, 0, 1.078125, 0, 50.25, 54.1875 165 | ThonburiBold = 72, 72, 72, 78, -17, 52.78125, 99, 105, 51, 0, 0.21875, 0, 50.28125, 53.609375 166 | Times = 72, 72, 72, 54, -18, 50, 72, 124, 51, 0, 1, 0, 50, 48.25 167 | 168 | TitilliumWeb-Black = 72, 72, 72, 82, -28, 48.359375, 110, 119, 45, 0, -0.359375, 0.21875, 45.515625, 48 169 | TitilliumWeb-Bold = 72, 72, 72, 82, -28, 48.78125, 110, 81, 43, 0, 1.21875, 0, 42.125, 49.234375 170 | TitilliumWeb-BoldItalic = 72, 72, 72, 82, -28, 40.0625, 110, 74, 40, 0, 0.9375, 0.453125, 40.109375, 49.25 171 | TitilliumWeb-ExtraLight = 72, 72, 72, 82, -28, 48.984375, 110, 82, 43, 0, 2.015625, 0, 40.609375, 51 172 | TitilliumWeb-ExtraLightItalic = 72, 72, 72, 82, -28, 42.703125, 110, 82, 40, 0, 2.296875, 0, 38.15625, 51 173 | TitilliumWeb-Italic = 72, 72, 72, 82, -28, 40.265625, 110, 79, 40, 0, 1.734375, 0, 38.296875, 50 174 | TitilliumWeb-Light = 72, 72, 72, 82, -28, 48.203125, 110, 82, 43, 0, 1.796875, 0, 40.96875, 50 175 | TitilliumWeb-LightItalic = 72, 72, 72, 82, -28, 41.0625, 110, 80, 40, 0, 1.9375, 0, 38.234375, 51 176 | TitilliumWeb-Regular = 72, 72, 72, 82, -28, 48.265625, 110, 82, 43, 0, 1.734375, 0, 41.1875, 50 177 | TitilliumWeb-SemiBold = 72, 72, 72, 82, -28, 48.5625, 110, 81, 43, 0, 1.4375, 0, 41.765625, 50 178 | TitilliumWeb-SemiBoldItalic = 72, 72, 72, 82, -28, 37.703125, 110, 76, 40, 0, 1.296875, -0.328125, 38.875, 49 179 | 180 | Noteworthy_0 = 72, 72, 72, 93, -24, 0, 116, 96, 0, 0, 0, -0.375, 1.078125, 1.078125 181 | Noteworthy_1 = 72, 72, 72, 93, -24, 0, 116, 107, 0, 0, 0, -0.375, 1.078125, 1.078125 182 | 183 | NothingYouCouldSay = 72, 72, 72, 87, -33, 3, 119, 89, 0, 0, 0, -0.515625, 0.84375, 0.84375 184 | 185 | NuevaStd-Bold = 72, 72, 72, 49, -24, 45, 86, 80, 43, 0, -1, 0, 44, 45 186 | NuevaStd-BoldCond = 72, 72, 72, 49, -24, 33, 86, 64, 31, 0, -2, 0, 31, 45 187 | NuevaStd-BoldCondItalic = 72, 72, 72, 49, -24, 30.546875, 86, 58, 29, 0, -3.546875, 0, 26.046875, 44 188 | NuevaStd-Cond = 72, 72, 72, 49, -24, 31, 86, 58, 30, 0, -1, 0, 30, 45 189 | NuevaStd-CondItalic = 72, 72, 72, 49, -24, 28.875, 86, 57, 27, 0, -3.875, 0, 24.375, 45 190 | NuevaStd-Italic = 72, 72, 72, 49, -24, 39, 86, 65, 37, 0, -4, 0, 35, 44 191 | 192 | SpecialElite-Regular = 72, 72, 72, 51, -22, 49, 72, 80, 40, 0, 0, -1, 40, 51 193 | 194 | Nymphette = 72, 72, 72, 65, -12, 1, 76, 124, 0, 0, 0, -0.1875, 0.828125, 0.828125 195 | Oriya MN = 72, 72, 72, 65, -21, 0, 87, 82, 0, 0, 0, -0.328125, 0.6875, 0.6875 196 | Raleway Thin = 72, 72, 72, 54, -18, 6, 72, 86, 0, 0, 0, -0.28125, 0.5625, 0.5625 197 | SpecialElite = 72, 72, 72, 51, -22, 9, 72, 80, 0, 0, 0, -0.34375, 0.453125, 0.453125 198 | Symbol = 72, 72, 72, 51, -22, 0, 72, 75, 0, 0, 0, -0.34375, 0.453125, 0.453125 199 | TalkingToTheMoon = 72, 72, 72, 72, -37, 1, 109, 62, 0, 0, 0, -0.578125, 0.546875, 0.546875 200 | Thonburi = 72, 72, 72, 78, -17, 2, 99, 105, 0, 0, 0, -0.265625, 0.953125, 0.953125 201 | ThonburiBold = 72, 72, 72, 78, -17, 2, 99, 105, 0, 0, 0, -0.265625, 0.953125, 0.953125 202 | Times = 72, 72, 72, 54, -18, 0, 72, 124, 0, 0, 0, -0.28125, 0.5625, 0.5625 203 | TitilliumWeb-Black = 72, 72, 72, 82, -28, 3, 110, 119, 0, 0, 0, -0.4375, 0.84375, 0.84375 204 | TitilliumWeb-Bold = 72, 72, 72, 82, -28, 7, 110, 81, 0, 0, 0, -0.4375, 0.84375, 0.84375 205 | TitilliumWeb-BoldItalic = 72, 72, 72, 82, -28, 0, 110, 74, 0, 0, 0, -0.4375, 0.84375, 0.84375 206 | TitilliumWeb-ExtraLight = 72, 72, 72, 82, -28, 8, 110, 82, 0, 0, 0, -0.4375, 0.84375, 0.84375 207 | TitilliumWeb-ExtraLightItalic = 72, 72, 72, 82, -28, 5, 110, 82, 0, 0, 0, -0.4375, 0.84375, 0.84375 208 | TitilliumWeb-Italic = 72, 72, 72, 82, -28, 2, 110, 79, 0, 0, 0, -0.4375, 0.84375, 0.84375 209 | TitilliumWeb-Light = 72, 72, 72, 82, -28, 7, 110, 82, 0, 0, 0, -0.4375, 0.84375, 0.84375 210 | TitilliumWeb-LightItalic = 72, 72, 72, 82, -28, 3, 110, 80, 0, 0, 0, -0.4375, 0.84375, 0.84375 211 | TitilliumWeb-Regular = 72, 72, 72, 82, -28, 7, 110, 82, 0, 0, 0, -0.4375, 0.84375, 0.84375 212 | TitilliumWeb-SemiBold = 72, 72, 72, 82, -28, 7, 110, 81, 0, 0, 0, -0.4375, 0.84375, 0.84375 213 | TitilliumWeb-SemiBoldItalic = 72, 72, 72, 82, -28, 0, 110, 76, 0, 0, 0, -0.4375, 0.84375, 0.84375 214 | 215 | VastShadow-Regular = 72, 72, 72, 66, -25, 75, 90, 107, 74, 0, 0, -3.8125, 74.140625, 43.875 216 | ZapfDingbats = 72, 72, 72, 59, -13, 37, 71, 73, 37, 0, 4, -10, 33, 51.046875 217 | 218 | ### ANDROID FONTS 219 | 220 | Roboto-Black = 72, 72, 72, 67, -18, 46.8594, 84, 87, 46, 0, 0.140625, 0, 45.8125, 52 221 | Roboto-BlackItalic = 72, 72, 72, 67, -18, 54.4844, 84, 85, 45, 0, -3.48438, 0, 49.0781, 51.3906 222 | Roboto-Bold = 72, 72, 72, 67, -18, 46.2188, 84, 86, 46, 0, 0.78125, 0, 45, 52 223 | Roboto-BoldItalic = 72, 72, 72, 67, -18, 52.8438, 84, 84, 45, 0, -2.84375, 0, 48.3125, 51.3906 224 | Roboto-Italic = 72, 72, 72, 67, -18, 49.5469, 84, 82, 44, 0, -1.54688, 0, 46.5156, 51.5 225 | Roboto-Light = 72, 72, 72, 67, -18, 43.0625, 84, 83, 44, 0, 1.9375, 0, 42.1562, 52 226 | Roboto-LightItalic = 72, 72, 72, 67, -18, 48.5781, 84, 81, 43, 0, -1.57812, 0, 45.25, 51.5 227 | Roboto-Medium = 72, 72, 72, 67, -18, 45.5625, 84, 85, 46, 0, 1.4375, 0, 44.1875, 52 228 | Roboto-MediumItalic = 72, 72, 72, 67, -18, 51.1406, 84, 83, 45, 0, -2.14062, 0, 47.5, 51.3906 229 | Roboto-Regular = 72, 72, 72, 67, -18, 44, 84, 84, 45, 0, 2, 0, 43.25, 52 230 | Roboto-Thin = 72, 72, 72, 67, -18, 41.0938, 84, 82, 43, 0, 1.90625, 0, 41.0625, 52 231 | Roboto-ThinItalic = 72, 72, 72, 67, -18, 46.4844, 84, 81, 42, 0, -1.48438, 0, 43.9062, 52 232 | 233 | -------------------------------------------------------------------------------- /fontvariations.txt: -------------------------------------------------------------------------------- 1 | # Table of fonts and their variation names. 2 | # For some, like Avenir, this is not obvious. 3 | # Avenir Roman is the base, but the italic should be Avenir-Oblique, and 4 | # the bold would be Avenir-Medium. 5 | # We retain in this list the Roman fonts, just for reference, 6 | # e.g. #ArialMT = ArialMT 7 | 8 | # 9 | # iOS Fonts for iOS 6.0 10 | # 11 | 12 | #Academy Engraved LET 13 | #AcademyEngravedLetPlain = AcademyEngravedLetPlain 14 | 15 | #American Typewriter 16 | #AmericanTypewriter = AmericanTypewriter 17 | AmericanTypewriter-Bold = AmericanTypewriter-Bold 18 | AmericanTypewriter-Condensed = AmericanTypewriter-Condensed 19 | AmericanTypewriter-CondensedBold = AmericanTypewriter-CondensedBold 20 | AmericanTypewriter-CondensedLight = AmericanTypewriter-CondensedLight 21 | AmericanTypewriter-Light = AmericanTypewriter-Light 22 | 23 | APHont-BoldItalic = APHont-BoldItalic 24 | APHont-Bold = APHont-Bold 25 | APHont-Italic = APHont-Italic 26 | APHont = APHont-Regular 27 | 28 | #Apple Color Emoji 29 | #AppleColorEmoji = AppleColorEmoji 30 | 31 | #Apple SD Gothic Neo 32 | AppleSDGothicNeo-Bold = AppleSDGothicNeo-Bold 33 | AppleSDGothicNeo-Medium = AppleSDGothicNeo-Medium 34 | 35 | #Arial 36 | #ArialMT = ArialMT 37 | Arial-BoldItalicMT = Arial-BoldItalicMT 38 | Arial-BoldMT = Arial-BoldMT 39 | Arial-ItalicMT = Arial-ItalicMT 40 | 41 | #Arial Hebrew 42 | #ArialHebrew = ArialHebrew 43 | ArialHebrew-Bold = ArialHebrew-Bold 44 | 45 | #Arial Rounded MT Bold 46 | #ArialRoundedMTBold = ArialRoundedMTBold 47 | 48 | #ASafePlacetoFall-Italic = TalkingtotheMoon 49 | ASafePlacetoFall-Italic = ASafePlacetoFall 50 | 51 | 52 | #Avenir 53 | Avenir-Bold = Avenir-Black 54 | Avenir-BoldItalic = Avenir-BlackOblique 55 | Avenir-Italic = Avenir-Oblique 56 | Avenir-Black = Avenir-Black 57 | Avenir-BlackOblique = Avenir-BlackOblique 58 | Avenir-Book = Avenir-Book 59 | Avenir-BookOblique = Avenir-BookOblique 60 | Avenir-Heavy = Avenir-Heavy 61 | Avenir-HeavyOblique = Avenir-HeavyOblique 62 | Avenir-Light = Avenir-Light 63 | Avenir-LightOblique = Avenir-LightOblique 64 | Avenir-Roman-Bold = Avenir-Medium 65 | Avenir-Roman-Italic = Avenir-Oblique 66 | 67 | #Avenir Next 68 | AvenirNext-Bold = AvenirNext-Bold 69 | AvenirNext-BoldItalic = AvenirNext-BoldItalic 70 | AvenirNext-DemiBold = AvenirNext-DemiBold 71 | AvenirNext-DemiBoldItalic = AvenirNext-DemiBoldItalic 72 | AvenirNext-Heavy = AvenirNext-Heavy 73 | AvenirNext-HeavyItalic = AvenirNext-HeavyItalic 74 | AvenirNext-Italic = AvenirNext-Italic 75 | AvenirNext-Medium = AvenirNext-Medium 76 | AvenirNext-MediumItalic = AvenirNext-MediumItalic 77 | AvenirNext-Regular = AvenirNext-Regular 78 | AvenirNext-UltraLight = AvenirNext-UltraLight 79 | AvenirNext-UltraLightItalic = AvenirNext-UltraLightItalic 80 | 81 | #Avenir Next Condensed 82 | AvenirNextCondensed-Bold = AvenirNextCondensed-Bold 83 | AvenirNextCondensed-BoldItalic = AvenirNextCondensed-BoldItalic 84 | AvenirNextCondensed-DemiBold = AvenirNextCondensed-DemiBold 85 | AvenirNextCondensed-DemiBoldItalic = AvenirNextCondensed-DemiBoldItalic 86 | AvenirNextCondensed-Heavy = AvenirNextCondensed-Heavy 87 | AvenirNextCondensed-HeavyItalic = AvenirNextCondensed-HeavyItalic 88 | AvenirNextCondensed-Italic = AvenirNextCondensed-Italic 89 | AvenirNextCondensed-Medium = AvenirNextCondensed-Medium 90 | AvenirNextCondensed-MediumItalic = AvenirNextCondensed-MediumItalic 91 | AvenirNextCondensed-Regular = AvenirNextCondensed-Regular 92 | AvenirNextCondensed-UltraLight = AvenirNextCondensed-UltraLight 93 | AvenirNextCondensed-UltraLightItalic = AvenirNextCondensed-UltraLightItalic 94 | 95 | #Bangla Sangam MN 96 | #BanglaSangamMN = BanglaSangamMN 97 | BanglaSangamMN-Bold = BanglaSangamMN-Bold 98 | 99 | #Baskerville = Baskerville 100 | Baskerville-Bold = Baskerville-Bold 101 | Baskerville-BoldItalic = Baskerville-BoldItalic 102 | Baskerville-Italic = Baskerville-Italic 103 | Baskerville-SemiBold = Baskerville-SemiBold 104 | Baskerville-SemiBoldItalic = Baskerville-SemiBoldItalic 105 | 106 | #BobbyJ 107 | BobbyJ-Bold = BobbyJ-Bold 108 | BobbyJ = BobbyJ-Regular 109 | BobbyJ-Regular-Bold = BobbyJ-Bold 110 | BobbyJRough-Bd = BobbyJRough-Bd 111 | BobbyJRough-Rg = BobbyJRough-Rg 112 | BobbyJSerif-Bld = BobbyJSerif-Bld 113 | BobbyJSerif = BobbyJSerif-Rg 114 | 115 | #Bodoni Ornaments 116 | #BodoniOrnamentsITCTT = BodoniOrnamentsITCTT 117 | 118 | #Bodoni 72 119 | BodoniSvtyTwoITCTT-Bold = BodoniSvtyTwoITCTT-Bold 120 | BodoniSvtyTwoITCTT-Book = BodoniSvtyTwoITCTT-Book 121 | BodoniSvtyTwoITCTT-BookIta = BodoniSvtyTwoITCTT-BookIta 122 | 123 | #Bodoni 72 Oldstyle 124 | BodoniSvtyTwoOSITCTT-Bold = BodoniSvtyTwoOSITCTT-Bold 125 | BodoniSvtyTwoOSITCTT-Book = BodoniSvtyTwoOSITCTT-Book 126 | BodoniSvtyTwoOSITCTT-BookIt = BodoniSvtyTwoOSITCTT-BookIt 127 | BodoniSvtyTwoSCITCTT-Book = BodoniSvtyTwoSCITCTT-Book 128 | 129 | #Bradley Hand 130 | BradleyHandITCTT-Bold = BradleyHandITCTT-Bold 131 | 132 | #Chalkboard SE 133 | ChalkboardSE-Bold = ChalkboardSE-Bold 134 | ChalkboardSE-Light = ChalkboardSE-Light 135 | ChalkboardSE-Regular = ChalkboardSE-Regular 136 | 137 | #Chalkduster 138 | #Chalkduster = Chalkduster 139 | 140 | #Cochin 141 | #Cochin = Cochin 142 | Cochin-Bold = Cochin-Bold 143 | Cochin-BoldItalic = Cochin-BoldItalic 144 | Cochin-Italic = Cochin-Italic 145 | 146 | #Copperplate 147 | #Copperplate = Copperplate 148 | Copperplate-Bold = Copperplate-Bold 149 | Copperplate-Light = Copperplate-Light 150 | 151 | #Courier 152 | #Courier = Courier 153 | Courier-Bold = Courier-Bold 154 | Courier-BoldOblique = Courier-BoldOblique 155 | Courier-Oblique = Courier-Oblique 156 | 157 | #Courier New 158 | CourierNewPS-BoldItalicMT = CourierNewPS-BoldItalicMT 159 | CourierNewPS-BoldMT = CourierNewPS-BoldMT 160 | CourierNewPS-ItalicMT = CourierNewPS-ItalicMT 161 | #CourierNewPSMT = CourierNewPSMT 162 | 163 | #CrimsonText-Roman 164 | CrimsonText = CrimsonText-Roman 165 | CrimsonText-Bold = CrimsonText-Semibold 166 | CrimsonText-BoldItalic = CrimsonText-SemiboldItalic 167 | CrimsonText-Italic = CrimsonText-Italic 168 | 169 | #DB LCD Temp 170 | #DBLCDTempBlack = DBLCDTempBlack 171 | 172 | #Devanagari Sangam MN 173 | #DevanagariSangamMN = DevanagariSangamMN 174 | DevanagariSangamMN-Bold = DevanagariSangamMN-Bold 175 | 176 | #Didot 177 | #Didot = Didot 178 | Didot-Bold = Didot-Bold 179 | Didot-Italic = Didot-Italic 180 | 181 | #Euphemia UCAS 182 | #EuphemiaUCAS = EuphemiaUCAS 183 | EuphemiaUCAS-Bold = EuphemiaUCAS-Bold 184 | EuphemiaUCAS-Italic = EuphemiaUCAS-Italic 185 | 186 | #Futura 187 | Futura-CondensedExtraBold = Futura-CondensedExtraBold 188 | Futura-CondensedMedium = Futura-CondensedMedium 189 | Futura-Medium = Futura-Medium 190 | Futura-MediumItalic = Futura-MediumItalic 191 | 192 | #Geeza Pro 193 | #GeezaPro = GeezaPro 194 | GeezaPro-Bold = GeezaPro-Bold 195 | 196 | #Georgia 197 | #Georgia = Georgia 198 | Georgia-Bold = Georgia-Bold 199 | Georgia-BoldItalic = Georgia-BoldItalic 200 | Georgia-Italic = Georgia-Italic 201 | 202 | #Gill Sans 203 | #GillSans = GillSans 204 | GillSans-Bold = GillSans-Bold 205 | GillSans-BoldItalic = GillSans-BoldItalic 206 | GillSans-Italic = GillSans-Italic 207 | GillSans-Light = GillSans-Light 208 | GillSans-LightItalic = GillSans-LightItalic 209 | 210 | #Gujarati Sangam MN 211 | #GujaratiSangamMN = GujaratiSangamMN 212 | GujaratiSangamMN-Bold = GujaratiSangamMN-Bold 213 | 214 | #Gurmukhi MN 215 | #GurmukhiMN = GurmukhiMN 216 | GurmukhiMN-Bold = GurmukhiMN-Bold 217 | 218 | #Heiti SC 219 | STHeitiSC-Light = STHeitiSC-Light 220 | STHeitiSC-Medium = STHeitiSC-Medium 221 | 222 | #Heiti TC 223 | STHeitiTC-Light = STHeitiTC-Light 224 | STHeitiTC-Medium = STHeitiTC-Medium 225 | 226 | #Helvetica 227 | #Helvetica = Helvetica 228 | Helvetica-Bold = Helvetica-Bold 229 | Helvetica-BoldOblique = Helvetica-BoldOblique 230 | Helvetica-Light = Helvetica-Light 231 | Helvetica-LightOblique = Helvetica-LightOblique 232 | Helvetica-Oblique = Helvetica-Oblique 233 | 234 | #Helvetica Neue 235 | #HelveticaNeue = HelveticaNeue 236 | HelveticaNeue-Bold = HelveticaNeue-Bold 237 | HelveticaNeue-BoldItalic = HelveticaNeue-BoldItalic 238 | HelveticaNeue-CondensedBlack = HelveticaNeue-CondensedBlack 239 | HelveticaNeue-CondensedBold = HelveticaNeue-CondensedBold 240 | HelveticaNeue-Italic = HelveticaNeue-Italic 241 | HelveticaNeue-Light = HelveticaNeue-Light 242 | HelveticaNeue-LightItalic = HelveticaNeue-LightItalic 243 | HelveticaNeue-Medium = HelveticaNeue-Medium 244 | HelveticaNeue-UltraLight = HelveticaNeue-UltraLight 245 | HelveticaNeue-UltraLightItalic = HelveticaNeue-UltraLightItalic 246 | 247 | #Hiragino Kaku Gothic ProN 248 | HiraKakuProN-W3 = HiraKakuProN-W3 249 | HiraKakuProN-W6 = HiraKakuProN-W6 250 | 251 | #Hiragino Mincho ProN 252 | HiraMinProN-W3 = HiraMinProN-W3 253 | HiraMinProN-W6 = HiraMinProN-W6 254 | 255 | #Hoefler Text 256 | HoeflerText-Black = HoeflerText-Black 257 | HoeflerText-BlackItalic = HoeflerText-BlackItalic 258 | HoeflerText-Italic = HoeflerText-Italic 259 | HoeflerText-Regular = HoeflerText-Regular 260 | 261 | 262 | #JournalBold 263 | JournalBold-Bold = JournalBold 264 | JournalText-Bold = JournalBold 265 | JournalText-Italic = JournalItalic 266 | 267 | #Kailasa 268 | #Kailasa = Kailasa 269 | Kailasa-Bold = Kailasa-Bold 270 | 271 | #Kannada Sangam MN 272 | #KannadaSangamMN = KannadaSangamMN 273 | KannadaSangamMN-Bold = KannadaSangamMN-Bold 274 | 275 | #Malayalam Sangam MN 276 | #MalayalamSangamMN = MalayalamSangamMN 277 | MalayalamSangamMN-Bold = MalayalamSangamMN-Bold 278 | 279 | #Marion 280 | Marion-Bold = Marion-Bold 281 | Marion-Italic = Marion-Italic 282 | Marion-Regular = Marion-Regular 283 | 284 | #Marker Felt 285 | MarkerFelt-Thin = MarkerFelt-Thin 286 | MarkerFelt-Wide = MarkerFelt-Wide 287 | 288 | #Noteworthy 289 | Noteworthy-Bold = Noteworthy-Bold 290 | Noteworthy-Light = Noteworthy-Light 291 | 292 | #Optima 293 | Optima-Bold = Optima-Bold 294 | Optima-BoldItalic = Optima-BoldItalic 295 | Optima-ExtraBlack = Optima-ExtraBlack 296 | Optima-Italic = Optima-Italic 297 | Optima-Regular = Optima-Regular 298 | 299 | #Oriya Sangam MN 300 | #OriyaSangamMN = OriyaSangamMN 301 | OriyaSangamMN-Bold = OriyaSangamMN-Bold 302 | 303 | #Palatino 304 | Palatino-Bold = Palatino-Bold 305 | Palatino-BoldItalic = Palatino-BoldItalic 306 | Palatino-Italic = Palatino-Italic 307 | Palatino-Roman = Palatino-Roman 308 | 309 | #Papyrus 310 | #Papyrus = Papyrus 311 | Papyrus-Condensed = Papyrus-Condensed 312 | 313 | #Party LET 314 | #PartyLetPlain = PartyLetPlain 315 | 316 | #Sinhala Sangam MN 317 | #SinhalaSangamMN = SinhalaSangamMN 318 | SinhalaSangamMN-Bold = SinhalaSangamMN-Bold 319 | 320 | #Snell Roundhand 321 | #SnellRoundhand = SnellRoundhand 322 | SnellRoundhand-Black = SnellRoundhand-Black 323 | SnellRoundhand-Bold = SnellRoundhand-Bold 324 | 325 | #Symbol 326 | #Symbol = Symbol 327 | 328 | #Tamil Sangam MN 329 | #TamilSangamMN = TamilSangamMN 330 | TamilSangamMN-Bold = TamilSangamMN-Bold 331 | 332 | #Telugu Sangam MN 333 | #TeluguSangamMN = TeluguSangamMN 334 | TeluguSangamMN-Bold = TeluguSangamMN-Bold 335 | 336 | #Thonburi 337 | #Thonburi = Thonburi 338 | Thonburi-Bold = Thonburi-Bold 339 | 340 | #Times New Roman 341 | TimesNewRomanPS-BoldItalicMT = TimesNewRomanPS-BoldItalicMT 342 | TimesNewRomanPS-BoldMT = TimesNewRomanPS-BoldMT 343 | TimesNewRomanPS-ItalicMT = TimesNewRomanPS-ItalicMT 344 | #TimesNewRomanPSMT = TimesNewRomanPSMT 345 | 346 | #Trebuchet MS 347 | Trebuchet-BoldItalic = Trebuchet-BoldItalic 348 | #TrebuchetMS = TrebuchetMS 349 | TrebuchetMS-Bold = TrebuchetMS-Bold 350 | TrebuchetMS-Italic = TrebuchetMS-Italic 351 | 352 | #Verdana 353 | #Verdana = Verdana 354 | Verdana-Bold = Verdana-Bold 355 | Verdana-BoldItalic = Verdana-BoldItalic 356 | Verdana-Italic = Verdana-Italic 357 | 358 | #Zapf Dingbats 359 | #ZapfDingbatsITC = ZapfDingbatsITC 360 | 361 | #Zapfino 362 | #Zapfino = Zapfino 363 | 364 | 365 | # 366 | # Custom Fonts 367 | # 368 | 369 | #Crimson Text 370 | #CrimsonText-Roman = CrimsonText-Roman 371 | CrimsonText-Roman-Italic = CrimsonText-Italic 372 | CrimsonText-Roman-Bold = CrimsonText-Bold 373 | CrimsonText-Roman-Bold-Italic = CrimsonText-BoldItalic 374 | 375 | 376 | -------------------------------------------------------------------------------- /html.lua: -------------------------------------------------------------------------------- 1 | -- $Id: html.lua,v 1.2 2007-05-12 04:37:20 tclua Exp $ 2 | 3 | module(..., package.seeall) 4 | 5 | local lower = string.lower 6 | 7 | local entities = require ("scripts.textrender.entities") 8 | 9 | 10 | local entity = { 11 | nbsp = " ", 12 | lt = "<", 13 | gt = ">", 14 | quot = "\"", 15 | amp = "&", 16 | } 17 | 18 | -- keep unknown entity as is 19 | setmetatable(entity, { 20 | __index = function (t, key) 21 | return "&" .. key .. ";" 22 | end 23 | }) 24 | 25 | local block = { 26 | "address", 27 | "blockquote", 28 | "center", 29 | "dir", "div", "dl", 30 | "fieldset", "form", 31 | "h1", "h2", "h3", "h4", "h5", "h6", "hr", 32 | "isindex", 33 | "menu", 34 | "noframes", 35 | "ol", 36 | "p", 37 | "pre", 38 | "table", 39 | "ul", 40 | } 41 | 42 | local inline = { 43 | "a", "abbr", "acronym", "applet", 44 | "b", "basefont", "bdo", "big", "br", "button", 45 | "cite", "code", 46 | "dfn", 47 | "em", 48 | "font", 49 | "i", "iframe", "img", "input", 50 | "kbd", 51 | "label", 52 | "map", 53 | "object", 54 | "q", 55 | "s", "samp", "select", "small", "span", "strike", "strong", "sub", "sup", 56 | "textarea", "tt", 57 | "u", 58 | "var", 59 | } 60 | 61 | local tags = { 62 | a = { empty = false }, 63 | abbr = {empty = false} , 64 | acronym = {empty = false} , 65 | address = {empty = false} , 66 | applet = {empty = false} , 67 | area = {empty = true} , 68 | b = {empty = false} , 69 | base = {empty = true} , 70 | basefont = {empty = true} , 71 | bdo = {empty = false} , 72 | big = {empty = false} , 73 | blockquote = {empty = false} , 74 | body = { empty = false, }, 75 | br = {empty = true} , 76 | button = {empty = false} , 77 | caption = {empty = false} , 78 | center = {empty = false} , 79 | cite = {empty = false} , 80 | code = {empty = false} , 81 | col = {empty = true} , 82 | colgroup = { 83 | empty = false, 84 | optional_end = true, 85 | child = {"col",}, 86 | }, 87 | dd = {empty = false} , 88 | del = {empty = false} , 89 | dfn = {empty = false} , 90 | dir = {empty = false} , 91 | div = {empty = false} , 92 | dl = {empty = false} , 93 | dt = { 94 | empty = false, 95 | optional_end = true, 96 | child = { 97 | inline, 98 | "del", 99 | "ins", 100 | "noscript", 101 | "script", 102 | }, 103 | }, 104 | em = {empty = false} , 105 | fieldset = {empty = false} , 106 | font = {empty = false} , 107 | form = {empty = false} , 108 | frame = {empty = true} , 109 | frameset = {empty = false} , 110 | h1 = {empty = false} , 111 | h2 = {empty = false} , 112 | h3 = {empty = false} , 113 | h4 = {empty = false} , 114 | h5 = {empty = false} , 115 | h6 = {empty = false} , 116 | head = {empty = false} , 117 | hr = {empty = true} , 118 | html = {empty = false} , 119 | i = {empty = false} , 120 | iframe = {empty = false} , 121 | img = {empty = true} , 122 | input = {empty = true} , 123 | ins = {empty = false} , 124 | isindex = {empty = true} , 125 | kbd = {empty = false} , 126 | label = {empty = false} , 127 | legend = {empty = false} , 128 | li = { 129 | empty = false, 130 | optional_end = true, 131 | child = { 132 | inline, 133 | block, 134 | "del", 135 | "ins", 136 | "noscript", 137 | "script", 138 | }, 139 | }, 140 | link = {empty = true} , 141 | map = {empty = false} , 142 | menu = {empty = false} , 143 | meta = {empty = true} , 144 | noframes = {empty = false} , 145 | noscript = {empty = false} , 146 | object = {empty = false} , 147 | ol = {empty = false} , 148 | optgroup = {empty = false} , 149 | option = { 150 | empty = false, 151 | optional_end = true, 152 | child = {}, 153 | }, 154 | p = { 155 | empty = false, 156 | optional_end = true, 157 | child = { 158 | inline, 159 | "del", 160 | "ins", 161 | "noscript", 162 | "script", 163 | }, 164 | } , 165 | param = {empty = true} , 166 | pre = {empty = false} , 167 | q = {empty = false} , 168 | s = {empty = false} , 169 | samp = {empty = false} , 170 | script = {empty = false} , 171 | select = {empty = false} , 172 | small = {empty = false} , 173 | span = {empty = false} , 174 | strike = {empty = false} , 175 | strong = {empty = false} , 176 | style = {empty = false} , 177 | sub = {empty = false} , 178 | sup = {empty = false} , 179 | table = {empty = false} , 180 | tbody = {empty = false} , 181 | td = { 182 | empty = false, 183 | optional_end = true, 184 | child = { 185 | inline, 186 | block, 187 | "del", 188 | "ins", 189 | "noscript", 190 | "script", 191 | }, 192 | }, 193 | textarea = {empty = false} , 194 | tfoot = { 195 | empty = false, 196 | optional_end = true, 197 | child = {"tr",}, 198 | }, 199 | th = { 200 | empty = false, 201 | optional_end = true, 202 | child = { 203 | inline, 204 | block, 205 | "del", 206 | "ins", 207 | "noscript", 208 | "script", 209 | }, 210 | }, 211 | thead = { 212 | empty = false, 213 | optional_end = true, 214 | child = {"tr",}, 215 | }, 216 | title = {empty = false} , 217 | tr = { 218 | empty = false, 219 | optional_end = true, 220 | child = { 221 | "td", "th", 222 | }, 223 | }, 224 | tt = {empty = false} , 225 | u = {empty = false} , 226 | ul = {empty = false} , 227 | var = {empty = false} , 228 | } 229 | 230 | setmetatable(tags, { 231 | __index = function (t, key) 232 | return {empty = false} 233 | end 234 | }) 235 | 236 | -- string buffer implementation 237 | function newbuf () 238 | local buf = { 239 | _buf = {}, 240 | clear = function (self) self._buf = {}; return self end, 241 | content = function (self) return table.concat(self._buf) end, 242 | append = function (self, s) 243 | self._buf[#(self._buf) + 1] = s 244 | return self 245 | end, 246 | set = function (self, s) self._buf = {s}; return self end, 247 | } 248 | return buf 249 | end 250 | 251 | -- unescape character entities 252 | function unescape (s) 253 | function entity2string (e) 254 | e = entity[e] 255 | if e:len() > 1 then 256 | e = entities.dec_entity(e) 257 | end 258 | return e 259 | end 260 | return s.gsub(s, "&(#?%w+);", entity2string) 261 | end 262 | 263 | -- iterator factory 264 | function makeiter (f) 265 | local co = coroutine.create(f) 266 | return function () 267 | local code, res = coroutine.resume(co) 268 | return res 269 | end 270 | end 271 | 272 | -- constructors for token 273 | function Tag (s) 274 | return string.find(s, "^" then 303 | coroutine.yield(Tag(buf:append(c):content())) 304 | buf:clear() 305 | return text(f, buf) 306 | elseif c then 307 | buf:append(c) 308 | return tag(f, buf) 309 | else 310 | if buf:content() ~= "" then coroutine.yield(Tag(buf:content())) end 311 | end 312 | end 313 | 314 | function parse_starttag(tag) 315 | local tagname = string.match(tag, "<%s*(%w+)") 316 | local elem = {_attr = {}} 317 | elem._tag = lower(tostring(tagname)) 318 | for key, _, val in string.gmatch(tag, "(%w+)%s*=%s*([\"'])(.-)%2", i) do 319 | local unescaped = unescape(val) 320 | elem._attr[key] = unescaped 321 | end 322 | return elem 323 | end 324 | 325 | function parse_endtag(tag) 326 | local tagname = string.match(tag, "<%s*/%s*(%w+)") 327 | return lower(tostring(tagname)) 328 | end 329 | 330 | -- find last element that satisfies given predicate 331 | function rfind(t, pred) 332 | local length = #t 333 | for i=length,1,-1 do 334 | if pred(t[i]) then 335 | return i, t[i] 336 | end 337 | end 338 | end 339 | 340 | function flatten(t, acc) 341 | acc = acc or {} 342 | for i,v in ipairs(t) do 343 | if type(v) == "table" then 344 | flatten(v, acc) 345 | else 346 | acc[#acc + 1] = v 347 | end 348 | end 349 | return acc 350 | end 351 | 352 | function optional_end_p(elem) 353 | if tags[elem._tag].optional_end then 354 | return true 355 | else 356 | return false 357 | end 358 | end 359 | 360 | function valid_child_p(child, parent) 361 | local schema = tags[parent._tag].child 362 | if not schema then return true end 363 | 364 | for i,v in ipairs(flatten(schema)) do 365 | if v == child._tag then 366 | return true 367 | end 368 | end 369 | 370 | return false 371 | end 372 | 373 | -- tree builder 374 | function parse(f) 375 | local root = {_tag = "#document", _attr = {}} 376 | local stack = {root} 377 | for i in makeiter(function () return text(f, newbuf()) end) do 378 | if i.type == "Start" then 379 | local new = parse_starttag(i.value) 380 | local top = stack[#stack] 381 | 382 | while 383 | top._tag ~= "#document" and 384 | optional_end_p(top) and 385 | not valid_child_p(new, top) 386 | do 387 | stack[#stack] = nil 388 | top = stack[#stack] 389 | end 390 | 391 | top[#top+1] = new -- appendchild 392 | if not tags[new._tag].empty then 393 | stack[#stack+1] = new -- push 394 | end 395 | elseif i.type == "End" then 396 | local tag = parse_endtag(i.value) 397 | local openingpos = rfind(stack, function(v) 398 | if v._tag == tag then 399 | return true 400 | else 401 | return false 402 | end 403 | end) 404 | if openingpos then 405 | local length = #stack 406 | for j=length,openingpos,-1 do 407 | table.remove(stack, j) 408 | end 409 | end 410 | else -- Text 411 | local top = stack[#stack] 412 | top[#top+1] = i.value 413 | end 414 | end 415 | return root 416 | end 417 | 418 | function parsestr(s) 419 | local handle = { 420 | _content = s, 421 | _pos = 1, 422 | read = function (self, length) 423 | if self._pos > string.len(self._content) then return end 424 | local ret = string.sub(self._content, self._pos, self._pos + length - 1) 425 | self._pos = self._pos + length 426 | return ret 427 | end 428 | } 429 | return parse(handle) 430 | end -------------------------------------------------------------------------------- /textstyles-rgb.txt: -------------------------------------------------------------------------------- 1 | # style = font, size, leading, R,G,B, width, opacity, NORMAL|ALL_CAPS, text alignment, spaceBefore, spaceAfter, firstLineIndent, leftIndent, rightIndent 2 | 3 | #generic styles 4 | Normal = Avenir-Book,16,20,0,0,0,,100% 5 | Heading = Avenir-Bold,16,20,20,255,20,,100% 6 | Title=Avenir-Light,24,40,180,180,180,,100%,NORMAL,left,10,6,0,0,0 7 | H1=,18,26,0,0,0,,100%,NORMAL,left,12,4,0,0,0 8 | H2=Avenir-Book,18,26,0,0,0,,100%,NORMAL,left,12,4,0,0,0 9 | H2 Light=Avenir-Book,18,26,220,220,220,,100%,NORMAL,left,12,4,0,0,0 10 | H3=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 11 | H4=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 12 | H6=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 13 | H5=,16,26,0,0,0,,100%,NORMAL,left,8,0,0,0,0 14 | Quote = Avenir-Light,20,28,200,255,20,,100% 15 | 16 | # styles for the library 17 | eventListRowTime=AvenirNextCondensed-Medium,16,16,80,120,120,,100%,NORMAL,right,0,-20,0,0,0 18 | eventListRowTitle=AvenirNext-Medium,20,26,0,0,0,,100%,NORMAL,left,0,30,0,0,0 19 | eventListRowAuthor=Avenir-Light,14,14,160,160,160,,100%,NORMAL,left,0,14,0,0,0 20 | eventListRowDate=Avenir-Light,16,20,0,0,0,,100%,NORMAL,left,0,0,0,0,0 21 | eventListRowBody=Avenir-Book,14,22,100,100,100,,100%,NORMAL,left,0,0,0,0,0 22 | 23 | eventPageTitle=AvenirNext-Medium,36,40,0,0,0,,100%,NORMAL,left,0,20,0,0,0 24 | eventPageAuthor=Avenir-Light,18,22,0,0,0,,100%,NORMAL,left,0,10,0,0,0 25 | eventPageDate=Avenir-Light,16,20,0,0,0,,100%,NORMAL,left,0,10,0,0,0 26 | eventPageBody=Avenir-Light,16,24,0,0,0,,100%,NORMAL,left,0,0,0,0,0 27 | 28 | # styles for the settings screen 29 | settingsTitle=Avenir-Heavy,24,30,100,100,100,,100%,NORMAL,center,0,0,0,0,0 30 | settingsBody=Avenir-Light,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 31 | settingsLabel=Avenir-Medium,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 32 | 33 | # styles for captions 34 | caption=Avenir-Book,14,24,0,0,0,,100%,NORMAL,left,0,14,0,0,0 35 | caption-title=Avenir-Book,14,24,0,0,0,,100%,NORMAL,left,0,14,0,0,0 36 | 37 | #styles for table of contents 38 | contents-item = Avenir-Light,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 39 | 40 | # styles for the dialog screen 41 | dialogTitle=Avenir-Heavy,24,30,100,100,100,,100%,NORMAL,center,0,0,0,0,0 42 | dialogBody=Avenir-Light,16,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 43 | dialogLabel=Avenir-Medium,16,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 44 | dialogDescription=Avenir-Medium,16,20,100,100,120,,100%,NORMAL,left,0,12,0,0,0 45 | dialogLargeDescription=Avenir-Medium,18,24,60,60,60,,100%,NORMAL,left,0,12,0,0,0 46 | 47 | # testing styles 48 | Left = Baskerville,16,24, 0,0,0,,100%,NORMAL, left,0,0,0,0,0 49 | Right = Baskerville,16,24,0,0,0,,100%,NORMAL,right,0,0,0,0,0 50 | Center = Baskerville,16,24,0,0,0,,100%,NORMAL,center,0,0,0,0,0 51 | -------------------------------------------------------------------------------- /textstyles.txt: -------------------------------------------------------------------------------- 1 | # SAMPLE TEXT STYLES FOR CORONA GRAPHICS v2 (values between 0-1) 2 | 3 | # style = font, size, leading, R,G,B, width, opacity, NORMAL|ALL_CAPS, text alignment, spaceBefore, spaceAfter, firstLineIndent, leftIndent, rightIndent 4 | 5 | # default paragraph style 6 | body = Avenir-Roman ,16,20,0,0,0,,100%, none, left,0,0,0,0,0 7 | 8 | # hyperlink color (blue) 9 | a = ,,,0,0,255,,100% 10 | 11 | # common styles 12 | Heading = Avenir-Black,16,20,0,0,0,,100%,,left,0,0,0,0,0 13 | Title=Avenir-Black,24,40,0.5,0.5,0.5,,100%,,left,20,0,0,0,0 14 | 15 | H1=Avenir-Black ,24,26,0,0,0,,100%,,left,12,24,0,0,0 16 | H2=Avenir-Black ,20,26,0,0,0,,100%,,left,12,12,0,0,0 17 | H3=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 18 | H4=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 19 | H6=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 20 | H5=Avenir-Black,16,26,0,0,0,,100%,,left,8,0,0,0,0 21 | 22 | Quote = Avenir-Roman ,20,28,200,255,20,,100% 23 | 24 | hr = ,,,,,,,,, left,2,2,0,0,0 25 | 26 | # Default settings for hanging text in lists 27 | li = ,12,,,,,,,, left,0,0,-30,30,0 28 | ol = ,,,,,,,,, left,0,0,0,0,0 29 | 30 | # styles for the library 31 | eventListRowTime=AvenirNextCondensed-Medium,16,16,0.5,0.5,0.5,,100%,NORMAL,right,0,-20,0,0,0 32 | eventListRowTitle=AvenirNext-Medium,20,26,0,0,0,,100%,NORMAL,left,0,30,0,0,0 33 | eventListRowAuthor=Avenir-Light,14,14,.5,.5,.5,,100%,NORMAL,left,0,14,0,0,0 34 | eventListRowDate=Avenir-Light,16,20,0,0,0,,100%,NORMAL,left,0,0,0,0,0 35 | eventListRowBody=Avenir-Book,14,22,100,100,100,,100%,NORMAL,left,0,0,0,0,0 36 | 37 | eventPageTitle=AvenirNext-Medium,36,40,0,0,0,,100%,NORMAL,left,0,20,0,0,0 38 | eventPageAuthor=Avenir-Light,18,22,0,0,0,,100%,NORMAL,left,0,10,0,0,0 39 | eventPageDate=Avenir-Light,16,20,0,0,0,,100%,NORMAL,left,0,10,0,0,0 40 | eventPageBody=Avenir-Light,16,24,0,0,0,,100%,NORMAL,left,0,0,0,0,0 41 | 42 | # styles for the settings screen 43 | settingsTitle=Avenir-Heavy,24,30,100,100,100,,100%,NORMAL,center,0,0,0,0,0 44 | settingsBody=Avenir-Light,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 45 | settingsLabel=Avenir-Medium,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 46 | 47 | # styles for captions 48 | caption=Avenir-Book,14,24,0,0,0,,100%,NORMAL,left,0,14,0,0,0 49 | caption-title=Avenir-Book,14,24,0,0,0,,100%,NORMAL,left,0,14,0,0,0 50 | 51 | #styles for table of contents 52 | contents-item = Avenir-Light,18,24,60,60,60,,100%,NORMAL,left,0,24,0,0,0 53 | 54 | # styles for the dialog screen 55 | dialogTitle=Avenir-Heavy,24,30,.4,.4,.4,,100%,NORMAL,center,0,0,0,0,0 56 | dialogBody=Avenir-Light,16,24,.25,.25,.25,,100%,NORMAL,left,0,24,0,0,0 57 | dialogLabel=Avenir-Medium,16,24,.25,.25,.25,,100%,NORMAL,left,0,24,0,0,0 58 | dialogDescription=Avenir-Medium,16,20,0.5,0.5,0.5,,100%,NORMAL,left,0,12,0,0,0 59 | dialogLargeDescription=Avenir-Medium,18,24,.25,.25,.25,,100%,NORMAL,left,0,12,0,0,0 60 | 61 | # testing styles 62 | LeftIndent = Baskerville,16,24, 0,0,0,,100%,NORMAL, left,0,0,20,0,0 63 | Left = Baskerville,16,24, 0,0,0,,100%,NORMAL, left,0,0,0,0,0 64 | Right = Baskerville,16,24,0,0,0,,100%,NORMAL,right,0,0,0,0,0 65 | Center = Baskerville,16,24,0,0,0,,100%,NORMAL,center,0,0,0,0,0 66 | --------------------------------------------------------------------------------