Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: build SDL_TextEngine and option not to build it #389

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ SDL_TTF_LOCAL_PATH := $(call my-dir)
SUPPORT_HARFBUZZ ?= true
HARFBUZZ_LIBRARY_PATH := external/harfbuzz

# Enable this if you want to use SDL_TextEngine
SUPPORT_SDL_TEXTENGINE ?= true

FREETYPE_LIBRARY_PATH := external/freetype

# Build freetype library
Expand All @@ -25,6 +28,12 @@ LOCAL_MODULE := SDL3_ttf

LOCAL_SRC_FILES := src/SDL_ttf.c.neon

ifeq ($(SUPPORT_SDL_TEXTENGINE),true)
LOCAL_SRC_FILES += src/SDL_hashtable.c src/SDL_renderer_textengine.c src/SDL_surface_textengine.c
else
LOCAL_CFLAGS += -DSDL_DISABLE_TEXTENGINE
endif

LOCAL_C_INCLUDES += $(LOCAL_PATH)/include

LOCAL_CFLAGS += -O2
Expand Down
31 changes: 31 additions & 0 deletions src/SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4251,3 +4251,34 @@ int TTF_WasInit(void)
return SDL_GetAtomicInt(&TTF_state.refcount);
}

#if defined(SDL_DISABLE_TEXTENGINE)

TTF_TextEngine *TTF_CreateRendererTextEngine(SDL_Renderer *renderer)
{
return NULL;
}

TTF_TextEngine *TTF_CreateSurfaceTextEngine(void)
{
return NULL;
}

void TTF_DestroyRendererTextEngine(TTF_TextEngine *engine)
{
}

void TTF_DestroySurfaceTextEngine(TTF_TextEngine *engine)
{
}

bool TTF_DrawRendererText(TTF_Text *text, float x, float y)
{
return false;
}

bool TTF_DrawSurfaceText(TTF_Text *text, int x, int y, SDL_Surface *surface)
{
return false;
}

#endif
Loading