mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Merge pull request #18170 from hch12907/sdl-ttf
ci: use pkgconfig as a fallback for finding SDL2_ttf
This commit is contained in:
commit
3aed81d51b
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -333,7 +333,7 @@ jobs:
|
||||
run: |
|
||||
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
|
||||
sudo apt-get update -y -qq
|
||||
sudo apt-get install libsdl2-dev libgl1-mesa-dev libglu1-mesa-dev
|
||||
sudo apt-get install libsdl2-dev libgl1-mesa-dev libglu1-mesa-dev libsdl2-ttf-dev libfontconfig1-dev
|
||||
|
||||
- name: Install macOS dependencies
|
||||
if: runner.os == 'macOS'
|
||||
|
@ -261,6 +261,14 @@ if(NOT LIBRETRO AND NOT IOS AND NOT MACOSX)
|
||||
find_package(SDL2)
|
||||
find_package(SDL2_ttf)
|
||||
find_package(Fontconfig)
|
||||
|
||||
# TODO: this can be removed once CI supports newer SDL2_ttf
|
||||
if (NOT SDL2_ttf_FOUND)
|
||||
find_package(PkgConfig)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(SDL2_ttf_PKGCONFIG IMPORTED_TARGET SDL2_ttf)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MACOSX AND NOT IOS)
|
||||
@ -1335,15 +1343,19 @@ else()
|
||||
SDL/SDLVulkanGraphicsContext.cpp
|
||||
)
|
||||
endif()
|
||||
if(SDL2_ttf_FOUND)
|
||||
if(SDL2_ttf_FOUND OR SDL2_ttf_PKGCONFIG_FOUND)
|
||||
add_definitions(-DUSE_SDL2_TTF)
|
||||
set(nativeExtraLibs ${nativeExtraLibs} SDL2_ttf::SDL2_ttf)
|
||||
|
||||
if(FONTCONFIG_FOUND)
|
||||
add_definitions(-DUSE_SDL2_TTF_FONTCONFIG)
|
||||
set(nativeExtraLibs ${nativeExtraLibs} Fontconfig::Fontconfig)
|
||||
endif()
|
||||
endif()
|
||||
if(SDL2_ttf_FOUND)
|
||||
set(nativeExtraLibs ${nativeExtraLibs} SDL2_ttf::SDL2_ttf)
|
||||
elseif(SDL2_ttf_PKGCONFIG_FOUND)
|
||||
add_definitions(-DUSE_SDL2_TTF_PKGCONFIG)
|
||||
set(nativeExtraLibs ${nativeExtraLibs} PkgConfig::SDL2_ttf_PKGCONFIG)
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(nativeExtra ${nativeExtra}
|
||||
SDL/SDLMain.h
|
||||
|
@ -378,12 +378,14 @@ void TextDrawerSDL::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStrin
|
||||
font = fallbackFonts_[0];
|
||||
}
|
||||
|
||||
#ifndef USE_SDL2_TTF_PKGCONFIG
|
||||
if (align & ALIGN_HCENTER)
|
||||
TTF_SetFontWrappedAlign(font, TTF_WRAPPED_ALIGN_CENTER);
|
||||
else if (align & ALIGN_RIGHT)
|
||||
TTF_SetFontWrappedAlign(font, TTF_WRAPPED_ALIGN_RIGHT);
|
||||
else
|
||||
TTF_SetFontWrappedAlign(font, TTF_WRAPPED_ALIGN_LEFT);
|
||||
#endif
|
||||
|
||||
SDL_Color fgColor = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
SDL_Surface *text = TTF_RenderUTF8_Blended_Wrapped(font, processedStr.c_str(), fgColor, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user