|
| 1 | +# AngelicLove |
| 2 | +AngelicLove - is a set of vectorized self-constructing Angelic language image-fonts for Love2D. |
| 3 | +This project is inspired with NieR game series by Yoko Taro (at Square Enix) and mimics font variants presented in the games. |
| 4 | +You do not need to download anything external or store any files excpet the module itself for this library to work. All fonts are drawn and generated internally. |
| 5 | +> [!IMPORTANT] |
| 6 | +> Love2D 0.10.0 and higher is supported. |
| 7 | +
|
| 8 | + |
| 9 | + |
| 10 | +# Installation |
| 11 | +* Download latest angeliclove.lua from releases and put it in your require path. |
| 12 | + |
| 13 | +OR |
| 14 | +* submodule branch [angeliclove](https://github.com/REUSS-dev/AngelicLove/tree/angeliclove) of this repository into your project |
| 15 | + |
| 16 | +# Usage |
| 17 | +```lua |
| 18 | +-- Import AngelicLove via require as you usually do for modules |
| 19 | +local angelic = require("angeliclove") |
| 20 | + |
| 21 | +-- Create new AngelicFont object via `new` call from angeliclove lib |
| 22 | +local angelAuto = angelic.new(angelic.FontStyle.AUTOMATA, 30) |
| 23 | + |
| 24 | +-- Retrieve font from AngelicFont object and use it for your needs. |
| 25 | +local afont = angelAuto:getFont() |
| 26 | + |
| 27 | +function love.draw() |
| 28 | + love.graphics.setFont(afont) |
| 29 | + love.graphics.print("Hello world!", 100, 100) |
| 30 | +end |
| 31 | +``` |
| 32 | + |
| 33 | +You can also use `afont = angelic.new(angelic.FontStyle.AUTOMATA, 30):getFont()` to create LOVE2D font in one line, if you do not plan to make changes to it.\ |
| 34 | +\ |
| 35 | +`AngelicFont:getFont()` can also be safely called repeatedly. |
| 36 | +This allows to reflect changes you do to Angelic font elsewhere. |
| 37 | +```lua |
| 38 | +function love.draw() |
| 39 | + love.graphics.setFont(angelAuto:getFont()) |
| 40 | + love.graphics.print("Hello world!", 100, 100) |
| 41 | +end |
| 42 | + |
| 43 | +-- Makes font smaller when "F" key is pressed. |
| 44 | +function love.keypressed(key) |
| 45 | + if key == "f" then |
| 46 | + angelAuto:setSize(20) |
| 47 | + end |
| 48 | +end |
| 49 | +``` |
| 50 | +# Documentation |
| 51 | +### angelic.new(FontStyle|StylePreset style, number size, boolean noVariance): AngelicFont |
| 52 | +Create new AngelicFont object |
| 53 | +* `FontStyle|StylePreset style` - Font style of your newly created Angelic font. Can be either entry from FontStyle enum or self-defined style preset table (format below). |
| 54 | +* `number size` - Height of a character for a new Angelic font (in pixels) |
| 55 | +* `boolean noVariance` - When true, disables upper-case/lower-case variance for font styles that support it. |
| 56 | + |
| 57 | +A self-defined `StylePreset` can be created and used to create your own "unicode character to angelic character" correspondance map for your Angelic font. |
| 58 | +**Format of self-defined StylePreset table** |
| 59 | +```lua |
| 60 | +local stylePreset = { |
| 61 | + name = "myPreset", -- string |
| 62 | + characterVariant = angelic.CharacterVariant.Automata, -- CharacterVariant |
| 63 | + characters = { -- table<unicode_character, AngelicCharacter|{AngelicCharacter, AngelicCharacter}> Unicode to Angelic character map. |
| 64 | + -- Unicode character can be mapped to one Angelic character (both lower-case and upper-case variations of this unicode character will be mapped to this Angelic character) |
| 65 | + ["a"] = angelic.AngelicCharacter.ALEPH |
| 66 | + -- Or it can be mapped to two Angelic characters. Lower-case variant will use the first element of the table, upper-case variant will use second element of the table. If noVariance is enabled for this Angelic font, upper-case will also use first element of the table as its Angelic character. |
| 67 | + ["b"] = { angelic.AngelicCharacter.BETH, AngelicCharacter.VAU } |
| 68 | + |
| 69 | + -- All Angelic character names are exposed through enum angelic.AngelicCharacter |
| 70 | + } |
| 71 | +} |
| 72 | +``` |
| 73 | +### enum **FontStyle** |
| 74 | +Names of pre-defined style presets of Angelic alphabet variations used in NieR series games. |
| 75 | +*Exposed via angelic.FontStyle* |
| 76 | +* FontStyle.REPLICANT = `"replicant"` |
| 77 | +* FontStyle.AUTOMATA = `"automata"` |
| 78 | +* FontStyle.REINCARNATION = `"rein"` |
| 79 | + |
| 80 | +### enum **CharacterVariant** |
| 81 | +Names of Angelic character graphics variant. |
| 82 | +*Exposed via angelic.CharacterVariant* |
| 83 | +* CharacterVariant.AUTOMATA = `"automata"` - Robotic style, used in NieR:Automata and ReiN |
| 84 | +* CharacterVariant.REPLICANT = `"replicant"` - Runic style, used in NieR:Replicant |
| 85 | + |
| 86 | +### enum **AngelicCharacter** |
| 87 | +Names of Angelic characters used to identify them. |
| 88 | +*Exposed via angelic.AngelicCharacter* |
| 89 | +* ALEPH = `"aleph"` |
| 90 | +* BETH = `"beth"` |
| 91 | +* CHETH = `"cheth"` |
| 92 | +* DALETH = `"daleth"` |
| 93 | +* AIN = `"ain"` |
| 94 | +* PE = `"pe"` |
| 95 | +* GIMEL = `"gimel"` |
| 96 | +* HE = `"he"` |
| 97 | +* JOD = `"jod"` |
| 98 | +* CAPH = `"caph"` |
| 99 | +* LAMED = `"lamed"` |
| 100 | +* MEM = `"mem"` |
| 101 | +* NUN = `"nun"` |
| 102 | +* KUFF = `"kuff"` |
| 103 | +* RESH = `"resh"` |
| 104 | +* SAMECH = `"samech"` |
| 105 | +* SHIN = `"shin"` |
| 106 | +* TAU = `"tau"` |
| 107 | +* THETH = `"theth"` |
| 108 | +* VAU = `"vau"` |
| 109 | +* ZADE = `"zade"` |
| 110 | +* ZAIN = `"zain"` |
| 111 | +* RECT = `"rectangle"` |
| 112 | + |
| 113 | +## class AngelicFont |
| 114 | + |
| 115 | +### AngelicFont:getFont(): loveFont |
| 116 | +Get love.Font object of this Angelic font to be used in drawing operations. |
| 117 | + |
| 118 | +### AngelicFont:setSize(number size) |
| 119 | +Set new size for this Angelic font. |
| 120 | +* `number size` - Height of a character (in pixels) |
| 121 | + |
| 122 | +### AngelicFont:setStyle(FontStyle|StylePreset style) |
| 123 | +Set new style for this Angelic font. |
| 124 | +* `FontStyle|StylePreset style` - Font style of this Angelic font. Can be either entry from FontStyle enum or self-defined style preset table (format explained above). |
| 125 | + |
| 126 | +### AngelicFont:setNoVariance(boolean noVariance) |
| 127 | +Update noVariance parameter for this Angelic font. |
| 128 | +* `boolean noVariance` - When true, disables upper-case/lower-case variance for font styles that support it. |
0 commit comments