mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-06-11 00:14:05 +09:00
Compare commits
5 Commits
fb935ab28f
...
v1.16
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bc365fc57 | ||
|
|
69f868c3e8 | ||
|
|
a1147c8611 | ||
|
|
4bd8febfdf | ||
|
|
04fbddb200 |
30
.claude/settings.local.json
Normal file
30
.claude/settings.local.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"WebFetch(domain:github.com)",
|
||||
"WebSearch",
|
||||
"Bash(head:*)",
|
||||
"WebFetch(domain:gitlab.com)",
|
||||
"Bash(java:*)",
|
||||
"Bash(ls:*)",
|
||||
"Bash(jar tf:*)",
|
||||
"Bash(chmod +x:*)",
|
||||
"WebFetch(domain:fontforge.org)",
|
||||
"WebFetch(domain:fonttools.readthedocs.io)",
|
||||
"Bash(grep:*)",
|
||||
"Bash(tail:*)",
|
||||
"Bash(python3:*)",
|
||||
"Bash(make:*)",
|
||||
"Bash(git stash:*)",
|
||||
"Bash(./autokem*)",
|
||||
"Bash(cmp:*)",
|
||||
"Bash(wc:*)",
|
||||
"Bash(pip3:*)",
|
||||
"Bash(pip install:*)",
|
||||
"Bash(.venv/bin/python3:*)",
|
||||
"Bash(.venv/bin/python:*)",
|
||||
"Bash(find:*)",
|
||||
"Skill(update-config)"
|
||||
]
|
||||
}
|
||||
}
|
||||
93
.claude/skills/add-unicode-block/SKILL.md
Normal file
93
.claude/skills/add-unicode-block/SKILL.md
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
name: add-unicode-block
|
||||
description: Add a new Unicode script/block to the Terrarum Sans Bitmap font engine.
|
||||
---
|
||||
# Add Unicode Block
|
||||
|
||||
## Required inputs
|
||||
|
||||
The user must supply:
|
||||
- **Script name** — human-readable name used in constant/function names (e.g. `Ogham`, `LatinExtE`)
|
||||
- **TGA filename** — the sprite sheet filename without path (e.g. `ogham_variable.tga`)
|
||||
- **Unicode range** — start and end codepoints inclusive (e.g. `U+1680..U+169F`)
|
||||
|
||||
If any of these are missing, ask for them before proceeding.
|
||||
|
||||
## Step 1 — Determine the next sheet index
|
||||
|
||||
Read the sheet index constants from both files to find the current highest index (excluding `SHEET_UNKNOWN = 254`):
|
||||
|
||||
- Kotlin: `src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt` — grep for `internal const val SHEET_`
|
||||
- Python: `OTFbuild/sheet_config.py` — grep for `^SHEET_`
|
||||
|
||||
The new index = highest existing index + 1.
|
||||
|
||||
## Step 2 — Derive identifiers
|
||||
|
||||
From the script name, derive:
|
||||
- **Kotlin constant**: `SHEET_<UPPER_SNAKE>_VARW` (e.g. `SHEET_OGHAM_VARW`)
|
||||
- **Kotlin indexY function**: `<camelCase>IndexY` (e.g. `oghamIndexY`)
|
||||
- **Python constant**: same as Kotlin constant
|
||||
- **Range start hex**: the lower bound codepoint as a `0x`-prefixed Kotlin/Python literal
|
||||
|
||||
## Step 3 — Edit both files
|
||||
|
||||
Make all 6 edits. Read each section before editing.
|
||||
|
||||
### Kotlin: `src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt`
|
||||
|
||||
**a) Sheet index constant** — find the block of `internal const val SHEET_*` constants (just before `SHEET_UNKNOWN = 254`) and append:
|
||||
```kotlin
|
||||
internal const val SHEET_<NAME>_VARW = <INDEX>
|
||||
```
|
||||
|
||||
**b) fileList entry** — find `internal val fileList` array and append before the closing `)`:
|
||||
```kotlin
|
||||
"<tga_filename>",
|
||||
```
|
||||
|
||||
**c) codeRange entry** — find `internal val codeRange` array and append before the closing `)`:
|
||||
```kotlin
|
||||
0x<START>..<0x<END>, // SHEET_<NAME>_VARW
|
||||
```
|
||||
Use `+` to combine non-contiguous ranges if needed.
|
||||
|
||||
**d) getSheetwisePosition when-branch** — find the `when` block that dispatches to indexY functions (just before `else -> ch / 16`) and append:
|
||||
```kotlin
|
||||
SHEET_<NAME>_VARW -> <camelCase>IndexY(ch)
|
||||
```
|
||||
|
||||
**e) indexY function** — find the block of private `*IndexY` functions near the bottom of the companion object and append:
|
||||
```kotlin
|
||||
private fun <camelCase>IndexY(c: CodePoint) = (c - 0x<START>) / 16
|
||||
```
|
||||
|
||||
### Python: `OTFbuild/sheet_config.py`
|
||||
|
||||
**f) Sheet index constant** — find the block of `SHEET_* = <n>` constants (just before `SHEET_UNKNOWN = 254`) and append:
|
||||
```python
|
||||
SHEET_<NAME>_VARW = <INDEX>
|
||||
```
|
||||
|
||||
**g) FILE_LIST entry** — find `FILE_LIST = [` array and append before the closing `]`:
|
||||
```python
|
||||
"<tga_filename>",
|
||||
```
|
||||
|
||||
**h) CODE_RANGE entry** — find `CODE_RANGE = [` array and append before the closing `]`:
|
||||
```python
|
||||
list(range(0x<START>, 0x<END+1>)), # <INDEX>: <ScriptName>
|
||||
```
|
||||
|
||||
**i) index_y lambda** — find the dict in `get_index_y(sheet_index, c)` (just before `SHEET_HANGUL: lambda: 0`) and append:
|
||||
```python
|
||||
SHEET_<NAME>_VARW: lambda: (c - 0x<START>) // 16,
|
||||
```
|
||||
|
||||
## Step 4 — Verify
|
||||
|
||||
After all edits, confirm:
|
||||
1. The Kotlin constant, fileList, codeRange, when-branch, and indexY function are all present and consistent.
|
||||
2. The Python constant, FILE_LIST, CODE_RANGE, and index_y lambda are all present and consistent.
|
||||
3. The indices in both files match.
|
||||
4. The range end in `CODE_RANGE` is `end + 1` (Python `range` is exclusive).
|
||||
@@ -16,8 +16,8 @@ import sheet_config as SC
|
||||
|
||||
# PUA range for Hangul jamo variant storage.
|
||||
# We need space for: max_col * max_row variants.
|
||||
# Using 0xF0600-0xF1E7F
|
||||
HANGUL_PUA_BASE = 0xF0600
|
||||
# Using 0x100000-0x10187F
|
||||
HANGUL_PUA_BASE = 0x100000
|
||||
|
||||
|
||||
def _compose_bitmaps(a, b, w, h):
|
||||
|
||||
@@ -273,7 +273,7 @@ def _generate_hangul_gsub(glyphs, has, jamo_data):
|
||||
continue
|
||||
for f in [0, 1]:
|
||||
try:
|
||||
row_ng = SC.get_han_initial_row(1, idx, f)
|
||||
row_ng = SC.get_han_initial_row(2, idx, f)
|
||||
except (ValueError, KeyError):
|
||||
continue
|
||||
jung_groups_general.setdefault((row_ng, f), []).append(jcp)
|
||||
|
||||
@@ -81,6 +81,7 @@ SHEET_LATIN_EXTG_VARW = 47
|
||||
SHEET_OGHAM_VARW = 48
|
||||
SHEET_COPTIC_VARW = 49
|
||||
SHEET_CYRILIC_EXTD_VARW = 50
|
||||
SHEET_MATHS1_VARW = 51
|
||||
|
||||
SHEET_UNKNOWN = 254
|
||||
|
||||
@@ -136,6 +137,7 @@ FILE_LIST = [
|
||||
"ogham_variable.tga",
|
||||
"coptic_variable.tga",
|
||||
"cyrilic_extD_variable.tga",
|
||||
"maths1_extrawide_variable.tga",
|
||||
]
|
||||
|
||||
CODE_RANGE = [
|
||||
@@ -179,7 +181,7 @@ CODE_RANGE = [
|
||||
list(range(0xF0520, 0xF0580)), # 37: Codestyle ASCII
|
||||
list(range(0xFB00, 0xFB18)), # 38: Alphabetic Presentation
|
||||
list(range(0x1B000, 0x1B170)), # 39: Hentaigana
|
||||
list(range(0x2400, 0x2440)), # 40: Control Pictures
|
||||
list(range(0x2400, 0x2450)), # 40: Control Pictures
|
||||
list(range(0x1FB00, 0x1FC00)), # 41: Legacy Computing
|
||||
list(range(0xA640, 0xA6A0)), # 42: Cyrillic Ext B
|
||||
list(range(0x2DE0, 0x2E00)), # 43: Cyrillic Ext A
|
||||
@@ -190,6 +192,7 @@ CODE_RANGE = [
|
||||
list(range(0x1680, 0x16A0)), # 48: Ogham
|
||||
list(range(0x2C80, 0x2D00)), # 49: Coptic
|
||||
list(range(0x1E030, 0x1E090)), # 50: Cyrillic Ext D
|
||||
list(range(0x2200, 0x2300)), # 51: Maths1
|
||||
]
|
||||
|
||||
CODE_RANGE_HANGUL_COMPAT = range(0x3130, 0x3190)
|
||||
@@ -575,5 +578,6 @@ def index_y(sheet_index, c):
|
||||
SHEET_OGHAM_VARW: lambda: (c - 0x1680) // 16,
|
||||
SHEET_COPTIC_VARW: lambda: (c - 0x2C80) // 16,
|
||||
SHEET_CYRILIC_EXTD_VARW: lambda: (c - 0x1E030) // 16,
|
||||
SHEET_MATHS1_VARW: lambda: (c - 0x2200) // 16,
|
||||
SHEET_HANGUL: lambda: 0,
|
||||
}.get(sheet_index, lambda: c // 16)()
|
||||
|
||||
Binary file not shown.
BIN
demo.PNG
BIN
demo.PNG
Binary file not shown.
|
Before Width: | Height: | Size: 177 KiB After Width: | Height: | Size: 179 KiB |
@@ -151,8 +151,10 @@ How multilingual? Real multilingual!
|
||||
⁃ Kana Extended-A
|
||||
⁃ Small Kana Extension
|
||||
⁃ Letterlike Symbols
|
||||
⁃ Mathematical Operators
|
||||
⁃ Number Forms
|
||||
⁃ Ogham
|
||||
⁃ Optical Character Recognition
|
||||
⁃ Phonetic Extensions
|
||||
⁃ Phonetic Extensions Supplement
|
||||
⁃ Runic
|
||||
|
||||
BIN
src/assets/bengali_variable.tga
LFS
BIN
src/assets/bengali_variable.tga
LFS
Binary file not shown.
BIN
src/assets/cjkpunct_variable.tga
LFS
BIN
src/assets/cjkpunct_variable.tga
LFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
src/assets/hayeren_variable.tga
LFS
BIN
src/assets/hayeren_variable.tga
LFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
src/assets/maths1_extrawide_variable.tga
LFS
Normal file
BIN
src/assets/maths1_extrawide_variable.tga
LFS
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/assets/puae000-e0ff.tga
LFS
BIN
src/assets/puae000-e0ff.tga
LFS
Binary file not shown.
BIN
src/assets/unipunct_variable.tga
LFS
BIN
src/assets/unipunct_variable.tga
LFS
Binary file not shown.
@@ -884,6 +884,7 @@ class TerrarumSansBitmap(
|
||||
SHEET_OGHAM_VARW -> oghamIndexY(ch)
|
||||
SHEET_COPTIC_VARW -> copticIndexY(ch)
|
||||
SHEET_CYRILIC_EXTD_VARW -> cyrilicExtDIndexY(ch)
|
||||
SHEET_MATHS1_VARW -> maths1IndexY(ch)
|
||||
else -> ch / 16
|
||||
}
|
||||
|
||||
@@ -2618,6 +2619,7 @@ class TerrarumSansBitmap(
|
||||
internal const val SHEET_OGHAM_VARW = 48
|
||||
internal const val SHEET_COPTIC_VARW = 49
|
||||
internal const val SHEET_CYRILIC_EXTD_VARW = 50
|
||||
internal const val SHEET_MATHS1_VARW = 51
|
||||
|
||||
internal const val SHEET_UNKNOWN = 254
|
||||
|
||||
@@ -2691,6 +2693,7 @@ class TerrarumSansBitmap(
|
||||
"ogham_variable.tga",
|
||||
"coptic_variable.tga",
|
||||
"cyrilic_extD_variable.tga",
|
||||
"maths1_extrawide_variable.tga",
|
||||
)
|
||||
internal val codeRange = arrayOf( // MUST BE MATCHING WITH SHEET INDICES!!
|
||||
0..0xFF, // SHEET_ASCII_VARW
|
||||
@@ -2733,7 +2736,7 @@ class TerrarumSansBitmap(
|
||||
0xF0520..0xF057F, // SHEET_CODESTYLE_ASCII_VARW
|
||||
0xFB00..0xFB17, // SHEET_ALPHABETIC_PRESENTATION_FORMS
|
||||
0x1B000..0x1B16F, // SHEET_HENTAIGANA_VARW
|
||||
0x2400..0x243F, // SHEET_CONTROL_PICTURES_VARW
|
||||
0x2400..0x244F, // SHEET_CONTROL_PICTURES_VARW
|
||||
0x1FB00..0x1FBFF, // SHEET_LEGACY_COMPUTING_VARW
|
||||
0xA640..0xA69F, // SHEET_CYRILIC_EXTB_VARW
|
||||
0x2DE0..0x2DFF, // SHEET_CYRILIC_EXTA_VARW
|
||||
@@ -2744,6 +2747,7 @@ class TerrarumSansBitmap(
|
||||
0x1680..0x169F, // SHEET_OGHAM_VARW
|
||||
0x2C80..0x2CFF, // SHEET_COPTIC_VARW
|
||||
0x1E030..0x1E08F, // SHEET_CYRILIC_EXTD_VARW
|
||||
0x2200..0x22FF, // SHEET_MATHS1_VARW
|
||||
)
|
||||
private val codeRangeHangulCompat = 0x3130..0x318F
|
||||
|
||||
@@ -3105,6 +3109,7 @@ class TerrarumSansBitmap(
|
||||
private fun oghamIndexY(c: CodePoint) = (c - 0x1680) / 16
|
||||
private fun copticIndexY(c: CodePoint) = (c - 0x2C80) / 16
|
||||
private fun cyrilicExtDIndexY(c: CodePoint) = (c - 0x1E030) / 16
|
||||
private fun maths1IndexY(c: CodePoint) = (c - 0x2200) / 16
|
||||
|
||||
val charsetOverrideDefault = Character.toChars(CHARSET_OVERRIDE_DEFAULT).toSurrogatedString()
|
||||
val charsetOverrideBulgarian = Character.toChars(CHARSET_OVERRIDE_BG_BG).toSurrogatedString()
|
||||
|
||||
BIN
work_files/bengali_variable.psd
LFS
BIN
work_files/bengali_variable.psd
LFS
Binary file not shown.
BIN
work_files/cjkpunct_variable.psd
LFS
BIN
work_files/cjkpunct_variable.psd
LFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
work_files/hayeren_variable.psd
LFS
BIN
work_files/hayeren_variable.psd
LFS
Binary file not shown.
Binary file not shown.
BIN
work_files/kana_variable.kra
LFS
BIN
work_files/kana_variable.kra
LFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
work_files/puae000-e0ff.psd
LFS
BIN
work_files/puae000-e0ff.psd
LFS
Binary file not shown.
BIN
work_files/unipunct_variable.psd
LFS
BIN
work_files/unipunct_variable.psd
LFS
Binary file not shown.
Reference in New Issue
Block a user