Skip to content

Commit

Permalink
added webOS default fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Oct 31, 2024
1 parent 1f19f50 commit bc1a0e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
13 changes: 8 additions & 5 deletions Makefile.webos
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ HAVE_DR_MP3 = 1
HAVE_DYNAMIC = 1
HAVE_DYLIB = 1
HAVE_EGL = 0
HAVE_FREETYPE = 0
HAVE_GDI = 1
HAVE_FREETYPE = 1
HAVE_GDI = 0
HAVE_GETADDRINFO = 1
HAVE_GETOPT_LONG = 1
HAVE_GLSL = 1
Expand Down Expand Up @@ -107,7 +107,7 @@ HAVE_RUNAHEAD = 1
HAVE_SDL = 0
HAVE_SDL2 = 1
HAVE_SHADERPIPELINE = 1
HAVE_STB_FONT = 1
HAVE_STB_FONT = 0
HAVE_STB_IMAGE = 1
HAVE_STB_VORBIS = 1
HAVE_STDIN_CMD = 1
Expand Down Expand Up @@ -152,6 +152,7 @@ DEFINES += -DHAVE_SDL2
DEFINES += -DHAVE_PULSE
DEFINES += -DHAVE_NETWORKING -DHAVE_IFINFO -DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_ASSETS -DHAVE_UPDATE_CORES
DEFINES += -DHAVE_NETWORKGAMEPAD
DEFINES += -DHAVE_FREETYPE
DEFINES += -DHAVE_UPDATE_CORE_INFO

PKG_CONFIG=pkg-config
Expand All @@ -160,8 +161,10 @@ SDL2_CFLAGS := $(shell $(PKG_CONFIG) --cflags sdl2)
SDL2_LIBS := $(shell $(PKG_CONFIG) --libs sdl2)
OPENGLES_LIBS = -lGLESv2
PULSE_LIBS = $(shell $(PKG_CONFIG) --libs libpulse)
FREETYPE_CFLAGS := $(shell $(WEBOS_FREETYPE_CONFIG) --cflags)
FREETYPE_LIBS := $(shell $(WEBOS_FREETYPE_CONFIG) --libs)
FREETYPE_CFLAGS := $(shell $(PKG_CONFIG) --cflags freetype2)
FREETYPE_LIBS := $(shell $(PKG_CONFIG) --libs freetype2)
FONTCONFIG_CFLAGS := $(shell $(PKG_CONFIG) --cflags fontconfig)
FONTCONFIG_LIBS := $(shell $(PKG_CONFIG) --libs fontconfig)
MMAP_LIBS = -lc
NEON_CFLAGS = -mfpu=neon
NEON_ASFLAGS = -mfpu=neon
Expand Down
16 changes: 10 additions & 6 deletions gfx/drivers_font_renderer/freetype.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ static bool font_renderer_create_atlas(ft_font_renderer_t *handle, float font_si
unsigned i, x, y;
freetype_atlas_slot_t* slot = NULL;

unsigned max_width = round((handle->face->bbox.xMax - handle->face->bbox.xMin)
unsigned max_width = round((handle->face->bbox.xMax - handle->face->bbox.xMin)
* font_size / handle->face->units_per_EM);
unsigned max_height = round((handle->face->bbox.yMax - handle->face->bbox.yMin)
unsigned max_height = round((handle->face->bbox.yMax - handle->face->bbox.yMin)
* font_size / handle->face->units_per_EM);

unsigned atlas_width = (max_width + FT_ATLAS_PADDING) * FT_ATLAS_COLS;
Expand Down Expand Up @@ -306,13 +306,13 @@ static void *font_renderer_ft_init(const char *font_path, float font_size)
int face_index = 0;
/* select Sans fonts */
FcPattern* pattern = FcNameParse((const FcChar8*)"Sans");
/* since fontconfig uses LL-TT style, we need to normalize
/* since fontconfig uses LL-TT style, we need to normalize
* locale names */
FcChar8* locale = FcLangNormalize((const FcChar8*)get_user_language_iso639_1(false));
/* configure fontconfig substitute policies, this
/* configure fontconfig substitute policies, this
* will increase the search scope */
FcConfigSubstitute(config, pattern, FcMatchPattern);
/* pull in system-wide defaults, so the
/* pull in system-wide defaults, so the
* font selection respects system (or user) configurations */
FcDefaultSubstitute(pattern);

Expand Down Expand Up @@ -349,7 +349,7 @@ static void *font_renderer_ft_init(const char *font_path, float font_size)
FcPatternDestroy(found);
FcStrFree(locale);
FcConfigDestroy(config);

if (err)
goto error;
handle->file_data = font_data;
Expand Down Expand Up @@ -403,6 +403,10 @@ static const char *font_paths[] = {
"/Library/Fonts/Microsoft/Candara.ttf",
"/Library/Fonts/Verdana.ttf",
"/Library/Fonts/Tahoma.ttf",
#elif defined(WEBOS)
"/usr/share/fonts/MuseoSans-Medium.ttf",
"/usr/share/fonts/LG_Smart_UI-Regular.ttf",
"/usr/share/fonts/DroidSans.ttf",
#else
"/usr/share/fonts/TTF/DejaVuSansMono.ttf",
"/usr/share/fonts/TTF/DejaVuSans.ttf",
Expand Down

0 comments on commit bc1a0e8

Please sign in to comment.