mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Update readmes for new font system
There were still some TODOs left open for the font changes, and I also made a dedicated README.txt in the fonts directory.
This commit is contained in:
parent
17d3c756c7
commit
f896a964fa
3 changed files with 132 additions and 28 deletions
52
desktop_version/fonts/README.txt
Normal file
52
desktop_version/fonts/README.txt
Normal file
|
@ -0,0 +1,52 @@
|
|||
=== I N T R O D U C T I O N ===
|
||||
|
||||
This file will explain the font format.
|
||||
|
||||
If you need a font (like a TTF) converted into the format that the game can read, for now you might want to ask Dav, who has tools for it.
|
||||
|
||||
|
||||
|
||||
=== F O N T F O R M A T ===
|
||||
|
||||
Fonts consist of two files: a .png and a .fontmeta. The .png contains all the "images" for all glyphs, and the .fontmeta is an XML document containing all information about which characters are in the file and other metadata.
|
||||
|
||||
For example, a font for Japanese might be called font_ja.png and font_ja.fontmeta.
|
||||
|
||||
The fontmeta file looks like this:
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<font_metadata>
|
||||
<display_name>日本語</display_name>
|
||||
<width>12</width>
|
||||
<height>12</height>
|
||||
<white_teeth>1</white_teeth>
|
||||
<chars>
|
||||
<range start="0x20" end="0x7F"/>
|
||||
<range start="0xA0" end="0x17F"/>
|
||||
<range start="0x18F" end="0x18F"/>
|
||||
<range start="0x218" end="0x21B"/>
|
||||
<range start="0x259" end="0x25A"/>
|
||||
<!-- ... -->
|
||||
</chars>
|
||||
<special>
|
||||
<range start="0x00" end="0x1F" advance="6"/>
|
||||
<range start="0xEB00" end="0xEBFF" color="1"/>
|
||||
</special>
|
||||
</font_metadata>
|
||||
|
||||
|
||||
* display_name: the name of the language the font is specifically meant for - in the language itself. Users will see this in the level editor when choosing a font to use. If this font is used equally by multiple translations, this could be set to a combination like "繁體中文/한국어"
|
||||
|
||||
* width/height: the width and height of each glyph in the font. Every character will always be drawn as a rectangle of this size.
|
||||
|
||||
* white_teeth: indicates that all characters in the font are white, so the game itself doesn't have to remove all color from the image and make all pixels white like it would in old versions of the game. If this is not set to 1, this font cannot have colored (button) glyphs.
|
||||
|
||||
* chars: defines which characters are in the image. Starting at the top left of the image, each character is simply a rectangle of equal size (defined in <width> and <height>) from left to right, top to bottom. In the example given above, the image first has Unicode every character from U+0020 up to and including U+007F, then every character from U+00A0 to U+017F, and so on. To include a single character, simply use a range with equal start and end attributes equal.
|
||||
|
||||
* special: defines special attributes that will be applied to a range of characters. One or more of the following attributes can be used:
|
||||
|
||||
- color: set to 1 if these glyphs should be drawn with its original colors (for button glyphs, or even emoji...)
|
||||
|
||||
- advance: instead of <width>, the cursor (for drawing the next character) should be advanced this amount of pixels to the right. This controls the width of a character, but it does not affect how characters are arranged in the image, and the full glyph will still be drawn. While this means the font system has support for variable-width fonts, it's recommended to not use this option. There are some problems arising from using a variable-width font (especially in text boxes), so please consider copying the font's fullwidth forms (U+FF01-U+FF5E) to ASCII U+0021-U+007E instead. One may argue that a monospaced font also fits more with the game's style.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
=== I N T R O D U C T I O N ===
|
||||
|
||||
This fill will explain what you need to know when maintaining translations of VVVVVV (like adding new strings and syncing them across languages).
|
||||
This file will explain what you need to know when maintaining translations of VVVVVV (like adding new strings and syncing them across languages).
|
||||
|
||||
|
||||
|
||||
|
@ -16,6 +16,81 @@ The max value indicates how many characters of space there is for the text, and
|
|||
|
||||
|
||||
|
||||
=== T E X T P R I N T I N G ===
|
||||
|
||||
These are the text printing functions:
|
||||
|
||||
font::print(flags, x, y, text, r, g, b)
|
||||
font::print(flags, x, y, text, r, g, b, linespacing = -1, maxwidth = -1)
|
||||
|
||||
The flags argument can be 0, or a set of flags that do things like centering, enlarging, etc.
|
||||
|
||||
Some examples (can also be found in Font.h):
|
||||
|
||||
Standard print
|
||||
font::print(0, 50, 50, "Hello world!", 255, 255, 255);
|
||||
|
||||
Centered text
|
||||
font::print(PR_CEN, -1, 50, "Hello world!", 255, 255, 255);
|
||||
(set X to -1, unless you want to center *around* X)
|
||||
|
||||
2x scale
|
||||
font::print(PR_2X, 50, 50, "V", 255, 255, 255);
|
||||
|
||||
Centered 2x scale
|
||||
font::print(PR_CEN | PR_2X, -1, 50, "V", 255, 255, 255);
|
||||
|
||||
Right-aligned 3x scale with a border around it
|
||||
font::print(PR_RIGHT | PR_3X | PR_BOR, 320, 50, "V", 255, 255, 255);
|
||||
|
||||
Wordwrapped centered text
|
||||
font::print_wrap(PR_CEN, -1, 50, "Hello world, this will wordwrap to the screen width", 255, 255, 255);
|
||||
|
||||
A not-technically-exhaustive list of all flags (which are defined in Font.h):
|
||||
|
||||
- PR_2X/PR_3X/.../PR_8X Print at larger scale (PR_1X is default)
|
||||
- PR_FONT_INTERFACE [DEFAULT] Use interface (VVVVVV language) font
|
||||
- PR_FONT_LEVEL Use level-specific font (room names, cutscenes, etc)
|
||||
- PR_FONT_8X8 Use 8x8 font no matter what
|
||||
- PR_BRIGHTNESS(value) Use this brightness 0-255 (this value is mixed with
|
||||
r, g and b for an alpha effect)
|
||||
- PR_BOR Draw a black border around the text
|
||||
- PR_LEFT [DEFAULT] Left-align text/place at X coordinate
|
||||
- PR_CEN Center-align text relative to X (X is center)
|
||||
or to screen if X == -1
|
||||
- PR_RIGHT Right-align text to X
|
||||
(X is now the right border, not left border)
|
||||
- PR_CJK_CEN [DEFAULT] Large fonts (Chinese/Japanese/Korean) should
|
||||
stick out on top and bottom compared to 8x8 font
|
||||
- PR_CJK_LOW Larger fonts should stick out fully on the bottom
|
||||
(draw at Y)
|
||||
- PR_CJK_HIGH Larger fonts should stick out fully on the top
|
||||
|
||||
|
||||
|
||||
=== S T R I N G F O R M A T T I N G ===
|
||||
|
||||
Instead of sprintf-family functions, it is preferred to use VVVVVV's own formatting system, VFormat.
|
||||
|
||||
Strings sometimes have placeholders, which look like {name} or {name|flags}. For example, "{n_trinkets} of {max_trinkets}".
|
||||
|
||||
Placeholders can also have "flags" that modify their behavior. These can be added or removed in the translation as needed. Flags are separated by | (pipe).
|
||||
|
||||
For more info, see the documentation at the top of VFormat.h.
|
||||
|
||||
Full example:
|
||||
|
||||
char buffer[100];
|
||||
vformat_buf(buffer, sizeof(buffer),
|
||||
"{crewmate} got {number} out of {total} trinkets in {m}:{s|digits=2}.{ms|digits=3}",
|
||||
"number:int, total:int, crewmate:str, m:int, s:int, ms:int",
|
||||
2, 20, "Vermilion", 2, 3, 1
|
||||
);
|
||||
|
||||
=> "Vermilion got 2 out of 20 trinkets in 2:03.001"
|
||||
|
||||
|
||||
|
||||
=== T R A N S L A T O R M E N U ===
|
||||
|
||||
The translator menu has options for both translators and maintainers - it allows testing menus, translating room names within the game, syncing all language files with the English template files, getting statistics on translation progress, and more.
|
||||
|
@ -44,29 +119,6 @@ These files are untouched by the syncing feature.
|
|||
|
||||
|
||||
|
||||
=== S T R I N G F O R M A T T I N G ===
|
||||
|
||||
Instead of sprintf-family functions, it is preferred to use VVVVVV's own formatting system, VFormat.
|
||||
|
||||
Strings sometimes have placeholders, which look like {name} or {name|flags}. For example, "{n_trinkets} of {max_trinkets}".
|
||||
|
||||
Placeholders can also have "flags" that modify their behavior. These can be added or removed in the translation as needed. Flags are separated by | (pipe).
|
||||
|
||||
For more info, see the documentation at the top of VFormat.h.
|
||||
|
||||
Full example:
|
||||
|
||||
char buffer[100];
|
||||
vformat_buf(buffer, sizeof(buffer),
|
||||
"{crewmate} got {number} out of {total} trinkets in {m}:{s|digits=2}.{ms|digits=3}",
|
||||
"number:int, total:int, crewmate:str, m:int, s:int, ms:int",
|
||||
2, 20, "Vermilion", 2, 3, 1
|
||||
);
|
||||
|
||||
=> "Vermilion got 2 out of 20 trinkets in 2:03.001"
|
||||
|
||||
|
||||
|
||||
=== F I L E S ===
|
||||
|
||||
* meta.xml: This file contains some general information about a translation.
|
||||
|
|
|
@ -53,7 +53,7 @@ Irish: Specific letters may be kept in lowercase when making a string full-caps.
|
|||
|
||||
=== W O R D W R A P P I N G A N D L E N G T H L I M I T S ===
|
||||
|
||||
For most languages, VVVVVV can automatically wordwrap based on spaces. This may not work for some languages (like Chinese, Japanese and Korean), so... TODO
|
||||
For most languages, VVVVVV can automatically wordwrap based on spaces. This may not work for some languages (like Chinese, Japanese and Korean), so instead, newlines can be inserted manually (see below) and automatic wordwrapping can be disabled in meta.xml.
|
||||
|
||||
VVVVVV's resolution is 320x240, and the default font is 8x8, which means there is a 40x30 character grid (although we don't adhere to this grid for the UI, but it gives a good indication). Naturally, if the font has a different size like 12x12, less characters will fit on the screen too.
|
||||
|
||||
|
@ -65,7 +65,7 @@ Strings are usually annotated with their limits (for example, max="38*3"). This
|
|||
|
||||
(B) if X*Y (for example 33*3): the text should fit within an area of X characters wide and Y lines high. The text is automatically word-wrapped to fit (unless disabled in meta.xml). If automatic word-wrapping is disabled, you need to manually insert newlines with |, or possibly as a literal newline.
|
||||
|
||||
If your language uses a font with a different size than 8x8, there will be two limits given: `max`, which is the original limit based on the 8x8 font, and `max_local`, which is adapted to the size of your font. To get this notation, either use the maintenance option to sync language files from within VVVVVV, or use the Excel document. Ensure the correct font is set in meta.xml first.
|
||||
If your language uses a font with a different size than 8x8, there will be two limits given: `max`, which is the original limit based on the 8x8 font, and `max_local`, which is adapted to the size of your font. To get this notation, use the maintenance option to sync language files from within VVVVVV. Ensure the correct font is set in meta.xml first.
|
||||
|
||||
The translator menu has an option ("limits check") to automatically find strings that break the given limits. There may be a few cases where this detection isn't perfect, but it should be a helpful quality assurance tool.
|
||||
|
||||
|
@ -75,9 +75,9 @@ The maximum lengths are not always given. Notoriously, menu option buttons are p
|
|||
|
||||
=== F O N T S ===
|
||||
|
||||
The game uses an 8x8 pixel font by default (font.png and font.txt in the "fonts" folder). If your language can be represented in 8x8 characters, it is preferable to use this font. TODO
|
||||
The game uses an 8x8 pixel font by default (font.png and font.fontmeta in the "fonts" folder). If your language can be represented in 8x8 characters, it is preferable to use this font, or for this font to be extended.
|
||||
|
||||
TODO: The fonts directory will also have a README.txt file
|
||||
The fonts directory also has a README.txt file that explains how the font format works.
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue