Use U+FFFD instead of crashing when encountering unknown characters.
Also, use a nicer U+FFFD glyph in the builtin vector font.
This commit is contained in:
parent
923374b305
commit
cd6d891100
|
@ -103,15 +103,18 @@ add_custom_command(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/generated/bitmapfont.table.h
|
${CMAKE_CURRENT_BINARY_DIR}/generated/bitmapfont.table.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/fonts/unifont-8.0.01.hex.gz
|
${CMAKE_CURRENT_SOURCE_DIR}/fonts/unifont-8.0.01.hex.gz
|
||||||
${chars}
|
${chars}
|
||||||
DEPENDS unifont2c ${chars}
|
DEPENDS unifont2c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/fonts/unifont-8.0.01.hex.gz
|
||||||
|
${chars}
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/vectorfont.table.h
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/vectorfont.table.h
|
||||||
COMMAND $<TARGET_FILE:lff2c>
|
COMMAND $<TARGET_FILE:lff2c>
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/generated/vectorfont.table.h"
|
${CMAKE_CURRENT_BINARY_DIR}/generated/vectorfont.table.h
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/fonts/unicode.lff.gz"
|
${CMAKE_CURRENT_SOURCE_DIR}/fonts/unicode.lff.gz
|
||||||
DEPENDS lff2c ${chars}
|
DEPENDS lff2c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/fonts/unicode.lff.gz
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
|
|
||||||
set(generated_HEADERS
|
set(generated_HEADERS
|
||||||
|
|
Binary file not shown.
|
@ -625,7 +625,8 @@ void ssglInitializeBitmapFont()
|
||||||
|
|
||||||
int ssglBitmapCharWidth(char32_t chr) {
|
int ssglBitmapCharWidth(char32_t chr) {
|
||||||
if(!CodepointProperties[chr].exists)
|
if(!CodepointProperties[chr].exists)
|
||||||
oops();
|
chr = 0xfffd; // replacement character
|
||||||
|
|
||||||
return CodepointProperties[chr].isWide ? 2 : 1;
|
return CodepointProperties[chr].isWide ? 2 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,6 +634,9 @@ void ssglBitmapCharQuad(char32_t chr, double x, double y)
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
|
if(!CodepointProperties[chr].exists)
|
||||||
|
chr = 0xfffd; // replacement character
|
||||||
|
|
||||||
h = 16;
|
h = 16;
|
||||||
if(chr >= 0xe000 && chr <= 0xefff) {
|
if(chr >= 0xe000 && chr <= 0xefff) {
|
||||||
// Special character, like a checkbox or a radio button
|
// Special character, like a checkbox or a radio button
|
||||||
|
|
Loading…
Reference in New Issue
Block a user