Skip to content

Commit

Permalink
Preparing for version 5
Browse files Browse the repository at this point in the history
Now using TrueType technology!
More translation keys.
Halves and quarters.
Includes magic digits calculator function.
Updated metadata.
  • Loading branch information
AmberWat committed Jan 15, 2022
1 parent a1627b4 commit 19374b9
Show file tree
Hide file tree
Showing 33 changed files with 37,174 additions and 9,561 deletions.
4 changes: 3 additions & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Copyright (c) 2002 AmberW
Copyright (c) 2018-2022 AmberW
Magic digits calculator Copyright (c) 2020 vdvman1, included and modifed with permission


Attribution 4.0 International

Expand Down
150 changes: 118 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,131 @@
# Negative Space Font
This resource pack for Minecraft Java Edition contains a font with a lot of negative and positive size spaces. Included are also translations for easy use and magic digit support for use with scores.

## Raw characters:
`\uF801` to `\uF808`: -1 to -8 pixels
`\uF809` to `\uF80F`: -16, -32, -64, -128, -256, -512 and -1024 pixels
## What are negative spaces?
Instead of pushing things forward to the right, they pull things backward to the left. This allows for all kinds of tricks involving text and fonts. Especially since fonts can load textures, both big and small.

`\uF821` to `\uF828`: 1 to 8 pixels
`\uF829` to `\uF82F`: 16, 32, 64, 128, 256, 512 and 1024 pixels
## How to use character codes
Codes of the form `\uXXXX` or `\uXXXX\uXXXX` can be used directly, with the game automatically converting to the actual character when displayed. You can also perform the conversion yourself. [Unicode code converter](https://r12a.github.io/app-conversion/) is a simple web tool that can help (for Minecraft, look for JS/Java/C and uncheck ES6).

`\uF800` and `\uF820`: `-max` and `max`, maximally negative and positive
## Translation keys (Recommended)
These cover sizes between `-8192` and `8192` as well as `-max`/`max`. They are usually easier to use compared to dealing with raw character codes that are impossible to remember.

Adding `0x10` to a character code creates the *non splitting* version of that character, which causes text rendering to be processed in larger chunks. This improves performance but makes render order unpredictable when there is overlap. Luckily only a single *splitting* character is required to restore order.
They are also more future proof since they can be changed on the pack's end in case there are issues or new developments.

## Translation keys:
These cover *all* sizes between -1024 and 1024 as well as `-max`, `max` and multiples of 1024 up to 8192.

Add positive or negative spaces anywhere:
Use `space.<width>` to add positive or negative spaces anywhere:
```json
[{"text":"Start"},{"translate":"space.-11"},{"text":"End moved closer to the start by 11 pixels"}]
[{"text":"Start"},{"translate":"space.-11"},{"text":"End moved back 11 pixels"}]
```

Offset content inside `with` but then return to the original position:
Use `offset.<width>` to shift only the content inside `with` and then return:
```json
{"translate":"offset.-14","with":[{"text":"I'm offset 14 pixels to the left"}]}
["This is unaffected.",{"translate":"offset.-14","with":[{"text":"This part offset 14 pixels."}]},"This is also unaffected."]
```

*(These methods can accomplish the same things. Use whichever you prefer.)*

## Magic digits:
These make it possible to generate dynamic widths using scores and are optimized for maximum range without requiring a lookup table.
They require 1.16's multi font support and setting `"font":"space:default"`.

| Char | Result |
|:-----|:-----------|
| `9` | 1 wide |
| `8` | 3 wide |
| `7` | 8 wide |
| `6` | 21 wide |
| `5` | 55 wide |
| `4` | 144 wide |
| `3` | 377 wide |
| `2` | 987 wide |
| `1` | 2584 wide |
| `-` | -6765 wide |
## Basic characters (Intermediate)
These are available in a select number of sizes to strike a balance between ease of use and taking up valuable capacity.

| Regular (Recommended) | No-Split (Performance) | Width |
|-----------------------|------------------------|-------|
| `\uF844` | `\uF854` | -1/4 |
| `\uF842` | `\uF852` | -1/2 |
| `\uF801` | `\uF811` | -1 |
| `\uF802` | `\uF812` | -2 |
| `\uF803` | `\uF813` | -3 |
| `\uF804` | `\uF814` | -4 |
| `\uF805` | `\uF815` | -5 |
| `\uF806` | `\uF816` | -6 |
| `\uF807` | `\uF817` | -7 |
| `\uF808` | `\uF818` | -8 |
| `\uF809` | `\uF819` | -16 |
| `\uF80A` | `\uF81A` | -32 |
| `\uF80B` | `\uF81B` | -64 |
| `\uF80C` | `\uF81C` | -128 |
| `\uF80D` | `\uF81D` | -256 |
| `\uF80E` | `\uF81E` | -512 |
| `\uF80F` | `\uF81F` | -1024 |
| `\uF800` | `\uF810` | -max |


| Regular (Recommended) | No-Split (Performance) | Width |
|-----------------------|------------------------|-------|
| `\uF864` | `\uF874` | 1/4 |
| `\uF862` | `\uF872` | 1/2 |
| `\uF821` | `\uF831` | 1 |
| `\uF822` | `\uF832` | 2 |
| `\uF823` | `\uF833` | 3 |
| `\uF824` | `\uF834` | 4 |
| `\uF825` | `\uF835` | 5 |
| `\uF826` | `\uF836` | 6 |
| `\uF827` | `\uF837` | 7 |
| `\uF828` | `\uF838` | 8 |
| `\uF829` | `\uF839` | 16 |
| `\uF82A` | `\uF83A` | 32 |
| `\uF82B` | `\uF83B` | 64 |
| `\uF82C` | `\uF83C` | 128 |
| `\uF82D` | `\uF83D` | 256 |
| `\uF82E` | `\uF83E` | 512 |
| `\uF82F` | `\uF83F` | 1024 |
| `\uF820` | `\uF830` | max |

The **no-split** versions cause text rendering to be processed in larger chunks. This improves performance but makes render order unpredictable when there is overlap. However, they can be mixed and a single **regular** version character will fix the order.

## Magic digits (Intermediate)
These make it possible to generate dynamic widths without a lookup table by utilizing the easy manipulation of scoreboard values.
Because they override ordinary digits they require 1.16's multi font support and setting `"font":"space:default"`.

| Char | Width |
|:-----|:------|
| `9` | 1 |
| `8` | 3 |
| `7` | 8 |
| `6` | 21 |
| `5` | 55 |
| `4` | 144 |
| `3` | 377 |
| `2` | 987 |
| `1` | 2584 |
| `-` | -6765 |

If you're wondering, the widths come from taking every other Fibonacci number because of their property of adding up to the next term. It doesn't result in *the* best range, but other solutions seem to only add a few percent while being harder to calculate.

### Data pack
By loading the pack as a data pack rather than resource pack you can access sample functions for turning a width between -6764 and 6764 into a set of magic digits, ready for display. Big thanks to vdvman1 for helping with these.

See the function `spacefont:magic_digits` for more details.

## Supplemental characters (Advanced)
These use the upper parts of Unicode, allowing for vast amounts of characters. They are best used by plugins and third party tools since they are easy to calculate. It can be tricky to input these manually because of the use of [surrogate pairs](https://en.wikipedia.org/wiki/UTF-16#Code_points_from_U+010000_to_U+10FFFF).

[Unicode code converter](https://r12a.github.io/app-conversion/) is a fantastic tool for converting between formats (for Minecraft, look for JS/Java/C and uncheck ES6).

| Char | For Minecraft | Width |
|-------------|----------------|----------------|
| `\u{FFAF0}` | `\uDBBE\uDEF0` | -4096 |
| `\u{FFAF1}` | `\uDBBE\uDEF1` | -3840 |
| *...* | *...* | *steps of 256* |
| `\u{FFAFF}` | `\uDBBE\uDEFF` | -512 |
| `\u{FFB00}` | `\uDBBE\uDF00` | -256 |

| Char | For Minecraft | Width |
|-------------|----------------|----------------|
| `\u{FFB00}` | `\uDBBE\uDF00` | -256 |
| `\u{FFB01}` | `\uDBBE\uDF01` | -255 |
| *...* | *...* | *steps of 1* |
| `\u{FFBFF}` | `\uDBBE\uDFFF` | -1 |
| `\u{FFC00}` | `\uDBBF\uDC00` | 0 |
| `\u{FFC01}` | `\uDBBF\uDC01` | 1 |
| *...* | *...* | *steps of 1* |
| `\u{FFCFF}` | `\uDBBF\uDCFF` | 255 |
| `\u{FFD00}` | `\uDBBF\uDD00` | 256 |

| Char | For Minecraft | Width |
|------------ |----------------|----------------|
| `\u{FFD00}` | `\uDBBF\uDD00` | 256 |
| `\u{FFD01}` | `\uDBBF\uDD01` | 512 |
| *...* | *...* | *steps of 256* |
| `\u{FFD0F}` | `\uDBBF\uDD0F` | 3840 |
| `\u{FFD10}` | `\uDBBF\uDD10` | 4096 |

## Bugs and feedback
If you discover a bug, have a request or need help, please submit an issue on GitHub or contact AmberW#4615 on Discord.
Loading

0 comments on commit 19374b9

Please sign in to comment.