mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-18 07:04:07 +00:00
ttf support
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@473 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
38
src/core.c
38
src/core.c
@@ -421,8 +421,8 @@ static void inherit_text(MwWidget handle, const char* key, const char* default_v
|
||||
}
|
||||
|
||||
static void inherit_integer(MwWidget handle, const char* key, int default_value) {
|
||||
int n;
|
||||
MwWidget h = handle;
|
||||
int n;
|
||||
MwWidget h = handle;
|
||||
while(h != NULL) {
|
||||
if((n = MwGetInteger(h, key)) != -1) {
|
||||
MwSetInteger(handle, key, n);
|
||||
@@ -433,6 +433,36 @@ static void inherit_integer(MwWidget handle, const char* key, int default_value)
|
||||
MwSetInteger(handle, key, default_value);
|
||||
}
|
||||
|
||||
#ifdef USE_STB_TRUETYPE
|
||||
static void set_font(MwWidget handle) {
|
||||
void* f;
|
||||
MwWidget h = handle;
|
||||
while(h != NULL) {
|
||||
if((f = MwGetVoid(h, MwNfont)) != NULL) {
|
||||
MwSetVoid(handle, MwNfont, f);
|
||||
return;
|
||||
}
|
||||
h = h->parent;
|
||||
}
|
||||
f = MwFontLoad(MwTTFData, MwTTFDataSize);
|
||||
MwSetVoid(handle, MwNfont, f);
|
||||
}
|
||||
|
||||
static void set_boldfont(MwWidget handle) {
|
||||
void* f;
|
||||
MwWidget h = handle;
|
||||
while(h != NULL) {
|
||||
if((f = MwGetVoid(h, MwNboldFont)) != NULL) {
|
||||
MwSetVoid(handle, MwNboldFont, f);
|
||||
return;
|
||||
}
|
||||
h = h->parent;
|
||||
}
|
||||
f = MwFontLoad(MwBoldTTFData, MwBoldTTFDataSize);
|
||||
MwSetVoid(handle, MwNboldFont, f);
|
||||
}
|
||||
#endif
|
||||
|
||||
void MwSetDefault(MwWidget handle) {
|
||||
MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask);
|
||||
|
||||
@@ -443,6 +473,10 @@ void MwSetDefault(MwWidget handle) {
|
||||
#else
|
||||
inherit_integer(handle, MwNmodernLook, 1);
|
||||
#endif
|
||||
#ifdef USE_STB_TRUETYPE
|
||||
set_font(handle);
|
||||
set_boldfont(handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MwHideCursor(MwWidget handle) {
|
||||
|
||||
Reference in New Issue
Block a user