| 1 |
#!/bin/bash |
| •2 |
set -eux |
| 3 |
|
| 4 |
TEXTUREFONT2PASCAL='texture-font-to-pascal' |
| •5 |
TTF_FONTS_DIR=${1:-data} |
| 6 |
|
| 7 |
# Add option to have common Unicode characters available (not just ASCII), |
| 8 |
# this way we cover many Latin languages out-of-the-box, |
| 9 |
# see https://gist.github.com/ivandrofly/0fe20773bd712b303f78 . |
| 10 |
# Note: CGE applications can always define fonts that use more glyphs, |
| 11 |
# e.g. to support Japanese or Chinese see https://castle-engine.io/manual_text.php . |
| 12 |
TEXTUREFONT2PASCAL="${TEXTUREFONT2PASCAL} --sample-text-file=common_unicode_chars.txt" |
| 13 |
|
| 14 |
# Some texture-font-to-pascal options are useful for debugging what's going on. |
| 15 |
#TEXTUREFONT2PASCAL="${TEXTUREFONT2PASCAL} --debug-log --debug-font-image" |
| 16 |
|
| 17 |
# Used by Text node in X3DNodes. This font is drawn in 3D, |
| 18 |
# always automatically stretched to desired size, so you can freely |
| 19 |
# adjust TEXT_NODE_FONT_SIZE to balance the font texture size vs nice font look. |
| 20 |
# |
| 21 |
# The default value is the maximum value where we still fit all in (at most) |
| 22 |
# 2048x2048 texture. |
| 23 |
# We deliberately use unit and function names that make the unit/function indendepent of the size, |
| 24 |
# so that changing sizes used by default by CGE can be easily done by changing + |
| 25 |
# running this shell script. |
| 26 |
TEXT_NODE_FONT_SIZE=25 |
| •27 |
$TEXTUREFONT2PASCAL --size "${TEXT_NODE_FONT_SIZE}" ${TTF_FONTS_DIR}/DejaVuSans.ttf --unit-name CastleTextureFont_Default3D_Sans --function-name Font_Default3D_Sans |
| 28 |
|
| 29 |
# For other 11 font variants used by X3D, |
| 30 |
# see castle-model-viewer castle-model-viewer/embedded_data/fonts/ . |
| 31 |
# We no longer generate / embed them in CGE core. |
| 32 |
|
| 33 |
# Used by FallbackFont and (default) UIFont. |
| 34 |
# Note that changing the default size here will change the default font size in UI, |
| 35 |
# so we actually cannot do this, to not break compatibility. |
| •36 |
$TEXTUREFONT2PASCAL --size 20 ${TTF_FONTS_DIR}/DejaVuSans.ttf --unit-name CastleTextureFont_DefaultUi --function-name Font_DefaultUi |