mirror of
https://github.com/google/pebble.git
synced 2025-07-16 02:56:43 -04:00
Import of the watch repository from Pebble
This commit is contained in:
commit
3b92768480
10334 changed files with 2564465 additions and 0 deletions
147
src/fw/applib/fonts/codepoint.c
Normal file
147
src/fw/applib/fonts/codepoint.c
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "codepoint.h"
|
||||
|
||||
#include "util/size.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define MAX_LATIN_CODEPOINT 0x02AF
|
||||
#define MIN_SOFTBANK_EMOJI_CODEPOINT 0xE000
|
||||
#define MAX_SOFTBANK_EMOJI_CODEPOINT 0xE537
|
||||
#define MIN_UNIFIED_EMOJI_CODEPOINT 0x1F300
|
||||
#define MAX_UNIFIED_EMOJI_CODEPOINT 0x1F6FF
|
||||
#define MIN_SYMBOLS_CODEPOINT 0x2000
|
||||
#define MAX_SYMBOLS_CODEPOINT 0x2BFF
|
||||
#define MIN_IDEOGRAPH_CODEPOINT 0x2e80
|
||||
#define MIN_SPECIAL_CODEPOINT 0xE0A0
|
||||
#define MAX_SPECIAL_CODEPOINT 0xE0A2
|
||||
#define MIN_SKIN_TONE_CODEPOINT 0x1F3FB
|
||||
#define MAX_SKIN_TONE_CODEPOINT 0x1F3FF
|
||||
|
||||
// Note: Please keep these sorted
|
||||
static const Codepoint NONSTANDARD_EMOJI_CODEPOINTS[] = {
|
||||
0x2192, // rightwards_arrow
|
||||
0x25BA, // black_right_pointing_pointer
|
||||
0x2605, // black_star
|
||||
0x260E, // black_telephone
|
||||
0x261D, // white_up_pointing_index
|
||||
0x263A, // white_smiling_face
|
||||
0x270A, // raised_fist
|
||||
0x270B, // raised_hand
|
||||
0x270C, // victory_hand
|
||||
0x2764, // heavy_black_heart
|
||||
};
|
||||
|
||||
// Note: Please keep these sorted
|
||||
static const Codepoint END_OF_WORD_CODEPOINTS[] = {
|
||||
NULL_CODEPOINT, // 0x0
|
||||
NEWLINE_CODEPOINT, // 0xa
|
||||
SPACE_CODEPOINT, // 0x20
|
||||
HYPHEN_CODEPOINT, // 0x2d
|
||||
ZERO_WIDTH_SPACE_CODEPOINT // 0x200b
|
||||
};
|
||||
|
||||
// Note: Please keep these sorted
|
||||
static const Codepoint FORMATTING_CODEPOINTS[] = {
|
||||
0x7F, // delete
|
||||
0x200C, // zero-width non-joiner
|
||||
0x200D, // zero-width joiner
|
||||
0x200E, // left to right
|
||||
0x200F, // right to left
|
||||
0x202A, // bidirectional - right to left
|
||||
0x202C, // bidirectional - pop direction
|
||||
0x202D, // left to right override
|
||||
0xFE0E, // variation selector 1
|
||||
0xFE0F, // variation selector 2
|
||||
0xFEFF, // zero-width-no-break
|
||||
};
|
||||
|
||||
// Note: Please keep these sorted
|
||||
static const Codepoint ZERO_WIDTH_CODEPOINTS[] = {
|
||||
ZERO_WIDTH_SPACE_CODEPOINT,
|
||||
WORD_JOINER_CODEPOINT,
|
||||
};
|
||||
|
||||
static bool codepoint_in_list(const Codepoint codepoint, const Codepoint *codepoints, size_t size) {
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (codepoints[i] >= codepoint) {
|
||||
return (codepoints[i] == codepoint);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool codepoint_is_formatting_indicator(const Codepoint codepoint) {
|
||||
return codepoint_in_list(codepoint, FORMATTING_CODEPOINTS, ARRAY_LENGTH(FORMATTING_CODEPOINTS));
|
||||
}
|
||||
|
||||
bool codepoint_is_ideograph(const Codepoint codepoint) {
|
||||
if (codepoint > MIN_IDEOGRAPH_CODEPOINT) {
|
||||
// non ideographic characters. This is an approximation that is good enough until
|
||||
// we start supporting some exotic scripts (e.g. tibetan)
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// see http://www.unicode.org/reports/tr14/ for the whole enchilada
|
||||
bool codepoint_is_end_of_word(const Codepoint codepoint) {
|
||||
return codepoint_in_list(codepoint, END_OF_WORD_CODEPOINTS, ARRAY_LENGTH(END_OF_WORD_CODEPOINTS));
|
||||
}
|
||||
|
||||
// see http://unicode.org/reports/tr51/ section 2.2 "Diversity"
|
||||
bool codepoint_is_skin_tone_modifier(const Codepoint codepoint) {
|
||||
return (codepoint >= MIN_SKIN_TONE_CODEPOINT && codepoint <= MAX_SKIN_TONE_CODEPOINT);
|
||||
}
|
||||
|
||||
bool codepoint_should_skip(const Codepoint codepoint) {
|
||||
return ((codepoint < 0x20 && codepoint != NEWLINE_CODEPOINT) ||
|
||||
(codepoint_is_skin_tone_modifier(codepoint)));
|
||||
}
|
||||
|
||||
bool codepoint_is_zero_width(const Codepoint codepoint) {
|
||||
return codepoint_in_list(codepoint, ZERO_WIDTH_CODEPOINTS, ARRAY_LENGTH(ZERO_WIDTH_CODEPOINTS));
|
||||
}
|
||||
|
||||
bool codepoint_is_latin(const Codepoint codepoint) {
|
||||
return (codepoint <= MAX_LATIN_CODEPOINT ||
|
||||
(codepoint >= MIN_SYMBOLS_CODEPOINT &&
|
||||
codepoint <= MAX_SYMBOLS_CODEPOINT));
|
||||
}
|
||||
|
||||
bool codepoint_is_emoji(const Codepoint codepoint) {
|
||||
// search for the codepoint in the list of nonstandard emoji codepoints first.
|
||||
const bool found = codepoint_in_list(codepoint,
|
||||
NONSTANDARD_EMOJI_CODEPOINTS,
|
||||
ARRAY_LENGTH(NONSTANDARD_EMOJI_CODEPOINTS));
|
||||
if (found) {
|
||||
return true;
|
||||
} else {
|
||||
return ((codepoint >= MIN_SOFTBANK_EMOJI_CODEPOINT &&
|
||||
codepoint <= MAX_SOFTBANK_EMOJI_CODEPOINT) ||
|
||||
(codepoint >= MIN_UNIFIED_EMOJI_CODEPOINT &&
|
||||
codepoint <= MAX_UNIFIED_EMOJI_CODEPOINT));
|
||||
}
|
||||
}
|
||||
|
||||
bool codepoint_is_special(const Codepoint codepoint) {
|
||||
return (codepoint >= MIN_SPECIAL_CODEPOINT &&
|
||||
codepoint <= MAX_SPECIAL_CODEPOINT);
|
||||
}
|
54
src/fw/applib/fonts/codepoint.h
Normal file
54
src/fw/applib/fonts/codepoint.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef uint32_t Codepoint;
|
||||
|
||||
#define EM_DASH "—"
|
||||
#define EN_DASH "–"
|
||||
|
||||
#define ELLIPSIS_CODEPOINT 0x2026
|
||||
#define HYPHEN_CODEPOINT 0x002D
|
||||
#define MINUS_SIGN_CODEPOINT 0x2212
|
||||
#define SPACE_CODEPOINT ' '
|
||||
#define NEWLINE_CODEPOINT '\n'
|
||||
#define NULL_CODEPOINT '\0'
|
||||
#define ZERO_WIDTH_SPACE_CODEPOINT 0x200B
|
||||
#define WORD_JOINER_CODEPOINT 0x2060
|
||||
|
||||
bool codepoint_is_formatting_indicator(const Codepoint codepoint);
|
||||
|
||||
bool codepoint_is_skin_tone_modifier(const Codepoint codepoint);
|
||||
|
||||
bool codepoint_is_end_of_word(const Codepoint codepoint);
|
||||
|
||||
bool codepoint_is_ideograph(const Codepoint codepoint);
|
||||
|
||||
bool codepoint_should_skip(const Codepoint codepoint);
|
||||
|
||||
bool codepoint_is_zero_width(const Codepoint codepoint);
|
||||
|
||||
bool codepoint_is_latin(const Codepoint codepoint);
|
||||
|
||||
bool codepoint_is_emoji(const Codepoint codepoint);
|
||||
|
||||
// This is a least dirty hack to enable special rendering when a special codepoint is hit in the
|
||||
// text being rendered
|
||||
bool codepoint_is_special(const Codepoint codepoint);
|
147
src/fw/applib/fonts/fonts.c
Normal file
147
src/fw/applib/fonts/fonts.c
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "fonts.h"
|
||||
#include "fonts_private.h"
|
||||
|
||||
#include "applib/applib_malloc.auto.h"
|
||||
#include "applib/applib_resource.h"
|
||||
#include "applib/graphics/text.h"
|
||||
#include "applib/graphics/text_resources.h"
|
||||
#include "process_management/app_manager.h"
|
||||
#include "resource/resource.h"
|
||||
#include "resource/resource_ids.auto.h"
|
||||
#include "syscall/syscall.h"
|
||||
#include "system/passert.h"
|
||||
#include "system/logging.h"
|
||||
#include "util/list.h"
|
||||
#include "util/size.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
GFont fonts_get_fallback_font(void) {
|
||||
// No font key for the fallback font
|
||||
return sys_font_get_system_font(NULL);
|
||||
}
|
||||
|
||||
GFont fonts_get_system_font(const char *font_key) {
|
||||
static const char bitham_alias[] = "RESOURCE_ID_GOTHAM";
|
||||
static const char bitham_prefix[] = "RESOURCE_ID_BITHAM";
|
||||
static const size_t bitham_alias_len = sizeof(bitham_alias)-1;
|
||||
static const size_t bitham_prefix_len = sizeof(bitham_prefix)-1;
|
||||
|
||||
GFont res = sys_font_get_system_font(font_key);
|
||||
|
||||
// maybe they wanted a renamed font
|
||||
if (NULL == res && 0 == strncmp(font_key, bitham_alias, bitham_alias_len)) {
|
||||
char new_font_key[bitham_prefix_len - bitham_alias_len + strlen(font_key) + 1];
|
||||
strncpy(new_font_key, bitham_prefix, bitham_prefix_len);
|
||||
strcpy(new_font_key+bitham_prefix_len, font_key+bitham_alias_len);
|
||||
// let's try again
|
||||
res = sys_font_get_system_font(new_font_key);
|
||||
}
|
||||
|
||||
if (NULL == res) {
|
||||
PBL_LOG(LOG_LEVEL_DEBUG, "Getting fallback font instead");
|
||||
res = fonts_get_fallback_font();
|
||||
PBL_ASSERTN(res);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GFont fonts_load_custom_font(ResHandle handle) {
|
||||
GFont res = fonts_load_custom_font_system(sys_get_current_resource_num(), (uint32_t)handle);
|
||||
if (res == NULL) {
|
||||
PBL_LOG(LOG_LEVEL_WARNING, "Getting fallback font instead");
|
||||
res = sys_font_get_system_font("RESOURCE_ID_GOTHIC_14");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
GFont fonts_load_custom_font_system(ResAppNum app_num, uint32_t resource_id) {
|
||||
if (resource_id == 0) {
|
||||
PBL_LOG(LOG_LEVEL_ERROR, "Tried to load a font from a NULL resource");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FontInfo *font_info = applib_type_malloc(FontInfo);
|
||||
if (font_info == NULL) {
|
||||
PBL_LOG(LOG_LEVEL_ERROR, "Couldn't malloc space for new font");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool result = text_resources_init_font(app_num, resource_id,
|
||||
0 /* extended resource */, font_info);
|
||||
|
||||
if (!result) {
|
||||
// couldn't init the font
|
||||
applib_free(font_info);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return font_info;
|
||||
}
|
||||
|
||||
void fonts_unload_custom_font(GFont font) {
|
||||
// fonts_load_custom_font can return gothic 14 if loading their font didn't
|
||||
// work for whatever reason. We don't let the app know that it failed, so it makes sense that
|
||||
// they'll later try to unload this returned pointer at a later point. We don't actually want
|
||||
// to free this, so just no-op.
|
||||
if (font == sys_font_get_system_font("RESOURCE_ID_GOTHIC_14")) {
|
||||
return;
|
||||
}
|
||||
|
||||
FontInfo *font_info = (FontInfo*) font;
|
||||
applib_free(font_info);
|
||||
}
|
||||
|
||||
#if !RECOVERY_FW
|
||||
static const struct {
|
||||
const char *key_name;
|
||||
uint8_t height;
|
||||
} s_emoji_fonts[] = {
|
||||
// Keep this sorted in descending order
|
||||
{ FONT_KEY_GOTHIC_28_EMOJI, 28 },
|
||||
{ FONT_KEY_GOTHIC_24_EMOJI, 24 },
|
||||
{ FONT_KEY_GOTHIC_18_EMOJI, 18 },
|
||||
{ FONT_KEY_GOTHIC_14_EMOJI, 14 },
|
||||
};
|
||||
|
||||
FontInfo *fonts_get_system_emoji_font_for_size(unsigned int font_height) {
|
||||
for (uint32_t i = 0; i < ARRAY_LENGTH(s_emoji_fonts); i++) {
|
||||
if (font_height == s_emoji_fonts[i].height) {
|
||||
return sys_font_get_system_font(s_emoji_fonts[i].key_name);
|
||||
}
|
||||
}
|
||||
// Didn't find a suitable emoji font
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t fonts_get_font_height(GFont font) {
|
||||
FontInfo* fontinfo = (FontInfo*) font;
|
||||
return fontinfo->max_height;
|
||||
}
|
||||
|
||||
int16_t fonts_get_font_cap_offset(GFont font) {
|
||||
if (!font) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// FIXME PBL-25709: Actually use font-specific caps and also provide function for baseline offsets
|
||||
return (int16_t)(((int16_t)font->max_height) * 22 / 100);
|
||||
}
|
86
src/fw/applib/fonts/fonts.h
Normal file
86
src/fw/applib/fonts/fonts.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "applib/fonts/fonts_private.h"
|
||||
#include "resource/resource.h"
|
||||
|
||||
#if !defined(SDK)
|
||||
#include "font_resource_keys.auto.h"
|
||||
#endif
|
||||
|
||||
//! @addtogroup Graphics
|
||||
//! @{
|
||||
//! @addtogroup Fonts
|
||||
//! @see \ref TextLayer
|
||||
//! @see \ref TextDrawing
|
||||
//! @see \ref text_layer_set_font
|
||||
//! @see \ref graphics_draw_text
|
||||
//! @{
|
||||
|
||||
//! Pointer to opaque font data structure.
|
||||
//! @see \ref fonts_load_custom_font()
|
||||
//! @see \ref text_layer_set_font()
|
||||
//! @see \ref graphics_draw_text()
|
||||
typedef FontInfo* GFont;
|
||||
|
||||
//! @internal
|
||||
//! Gets the fallback system font (14pt Raster Gothic)
|
||||
GFont fonts_get_fallback_font(void);
|
||||
|
||||
//! Loads a system font corresponding to the specified font key.
|
||||
//! @param font_key The string key of the font to load. See
|
||||
//! <a href="https://developer.pebble.com/guides/app-resources/system-fonts/">System
|
||||
//! Fonts</a> guide for a list of system fonts.
|
||||
//! @return An opaque pointer to the loaded font, or, a pointer to the default
|
||||
//! (fallback) font if the specified font cannot be loaded.
|
||||
//! @note This may load a font from the flash peripheral into RAM.
|
||||
GFont fonts_get_system_font(const char *font_key);
|
||||
|
||||
GFont fonts_get_system_emoji_font_for_size(unsigned int font_size);
|
||||
|
||||
//! Loads a custom font.
|
||||
//! @param handle The resource handle of the font to load. See resource_ids.auto.h
|
||||
//! for a list of resource IDs, and use \ref resource_get_handle() to obtain the resource handle.
|
||||
//! @return An opaque pointer to the loaded font, or a pointer to the default
|
||||
//! (fallback) font if the specified font cannot be loaded.
|
||||
//! @see Read the <a href="http://developer.getpebble.com/guides/pebble-apps/resources/">App
|
||||
//! Resources</a> guide on how to embed a font into your app.
|
||||
//! @note this may load a font from the flash peripheral into RAM.
|
||||
GFont fonts_load_custom_font(ResHandle handle);
|
||||
|
||||
//! @internal
|
||||
//! firmware-only access version of fonts_load_custom_font
|
||||
GFont fonts_load_custom_font_system(ResAppNum app_num, uint32_t resource_id);
|
||||
|
||||
//! Unloads the specified custom font and frees the memory that is occupied by
|
||||
//! it.
|
||||
//! @note When an application exits, the system automatically unloads all fonts
|
||||
//! that have been loaded.
|
||||
//! @param font The font to unload.
|
||||
void fonts_unload_custom_font(GFont font);
|
||||
|
||||
//! @internal
|
||||
uint8_t fonts_get_font_height(GFont font);
|
||||
|
||||
//! @internal
|
||||
// Get the vertical offset of the top of the font's caps from the origin of a text frame
|
||||
// Currently only an approximation, see PBL-25709
|
||||
int16_t fonts_get_font_cap_offset(GFont font);
|
||||
|
||||
//! @} // end addtogroup Fonts
|
||||
//! @} // end addtogroup Graphics
|
98
src/fw/applib/fonts/fonts_private.h
Normal file
98
src/fw/applib/fonts/fonts_private.h
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "resource/resource.h"
|
||||
#include "util/attributes.h"
|
||||
|
||||
//
|
||||
// Definitions only for font loading and text rendering
|
||||
//
|
||||
|
||||
// Initial version
|
||||
#define FONT_VERSION_1 1
|
||||
// 4 byte codepoints in offset table
|
||||
#define FONT_VERSION_2 2
|
||||
// feature bits: 2 or 4 byte offsets, RLE encoding
|
||||
#define FONT_VERSION_3 3
|
||||
#define FEATURE_OFFSET_16 (1 << 0)
|
||||
#define FEATURE_RLE4 (1 << 1)
|
||||
|
||||
// HACK ALERT: Store the v3 FontMetaDataV3 feature bits in the top two bits of FontMetaData
|
||||
// version field. We need this information at the lowest levels and can't extend FontMetaData
|
||||
// for legacy support reasons.
|
||||
#define FONT_VERSION(_version) ((_version) & 0x3F)
|
||||
#define HAS_FEATURE(_version, _feature) ((_version) & (_feature))
|
||||
#define VERSION_FIELD_FEATURE_OFFSET_16 (1 << 7)
|
||||
#define VERSION_FIELD_FEATURE_RLE4 (1 << 6)
|
||||
|
||||
|
||||
// There are now three versions of the FontMetaData structure: V1 (formerly known as 'legacy'), V2
|
||||
// (still known as FontMetaData), and V3 (know as V3). We can't change the stack/memory usage
|
||||
// until we drop support for existing applications so we can't simply use V3 as the base.
|
||||
//
|
||||
// The name 'FontMetaData' is retained instead of a more consistent 'FontMetaDataV2' because the
|
||||
// uses of V1 and V3 are localized but 'FontMetaData' is used in many places, requiring many ugly
|
||||
// changes.
|
||||
typedef struct PACKED {
|
||||
uint8_t version;
|
||||
uint8_t max_height;
|
||||
uint16_t number_of_glyphs;
|
||||
uint16_t wildcard_codepoint;
|
||||
uint8_t hash_table_size;
|
||||
uint8_t codepoint_bytes;
|
||||
uint8_t size;
|
||||
uint8_t features;
|
||||
} FontMetaDataV3;
|
||||
|
||||
typedef struct PACKED {
|
||||
uint8_t version;
|
||||
uint8_t max_height;
|
||||
uint16_t number_of_glyphs;
|
||||
uint16_t wildcard_codepoint;
|
||||
uint8_t hash_table_size;
|
||||
uint8_t codepoint_bytes;
|
||||
} FontMetaData;
|
||||
|
||||
typedef struct PACKED {
|
||||
uint8_t version;
|
||||
uint8_t max_height;
|
||||
uint16_t number_of_glyphs;
|
||||
uint16_t wildcard_codepoint;
|
||||
} FontMetaDataV1;
|
||||
|
||||
typedef struct {
|
||||
FontMetaData md;
|
||||
ResAppNum app_num;
|
||||
uint32_t resource_id;
|
||||
} FontResource;
|
||||
|
||||
typedef struct {
|
||||
bool loaded;
|
||||
bool extended;
|
||||
uint8_t max_height;
|
||||
FontResource base;
|
||||
FontResource extension;
|
||||
ResourceCallbackHandle extension_changed_cb;
|
||||
} FontInfo;
|
||||
|
||||
typedef struct PACKED {
|
||||
uint8_t hash;
|
||||
uint8_t count;
|
||||
uint16_t offset;
|
||||
} FontHashTableEntry;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue