60 changed files with 305 additions and 1281 deletions
@ -1,197 +0,0 @@ |
|||||||
# - Find SDL2_ttf |
|
||||||
# Find the SDL2 headers and libraries |
|
||||||
# |
|
||||||
# SDL2::SDL2_ttf - Imported target |
|
||||||
# |
|
||||||
# SDL2_ttf_FOUND - True if SDL2_ttf was found. |
|
||||||
# SDL2_ttf_DYNAMIC - If we found a DLL version of SDL2_ttf |
|
||||||
# |
|
||||||
# Modified for SDL2_ttf of FindSDL2.cmake |
|
||||||
# Original Author: |
|
||||||
# 2015 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net> |
|
||||||
# |
|
||||||
# Copyright Sensics, Inc. 2015. |
|
||||||
# Distributed under the Boost Software License, Version 1.0. |
|
||||||
# (See accompanying file LICENSE_1_0.txt or copy at |
|
||||||
# http://www.boost.org/LICENSE_1_0.txt) |
|
||||||
|
|
||||||
# Set up architectures (for windows) and prefixes (for mingw builds) |
|
||||||
if(WIN32) |
|
||||||
if(MINGW) |
|
||||||
include(MinGWSearchPathExtras OPTIONAL) |
|
||||||
if(MINGWSEARCH_TARGET_TRIPLE) |
|
||||||
set(SDL2_ttf_PREFIX ${MINGWSEARCH_TARGET_TRIPLE}) |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) |
|
||||||
set(SDL2_ttf_LIB_PATH_SUFFIX lib/x64) |
|
||||||
if(NOT MSVC AND NOT SDL2_ttf_PREFIX) |
|
||||||
set(SDL2_ttf_PREFIX x86_64-w64-mingw32) |
|
||||||
endif() |
|
||||||
else() |
|
||||||
set(SDL2_ttf_LIB_PATH_SUFFIX lib/x86) |
|
||||||
if(NOT MSVC AND NOT SDL2_ttf_PREFIX) |
|
||||||
set(SDL2_ttf_PREFIX i686-w64-mingw32) |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
|
|
||||||
if(SDL2_ttf_PREFIX) |
|
||||||
set(SDL2_ttf_ORIGPREFIXPATH ${CMAKE_PREFIX_PATH}) |
|
||||||
if(SDL2_ttf_ROOT_DIR) |
|
||||||
list(APPEND CMAKE_PREFIX_PATH "${SDL2_ttf_ROOT_DIR}") |
|
||||||
endif() |
|
||||||
if(CMAKE_PREFIX_PATH) |
|
||||||
foreach(_prefix ${CMAKE_PREFIX_PATH}) |
|
||||||
list(APPEND CMAKE_PREFIX_PATH "${_prefix}/${SDL2_ttf_PREFIX}") |
|
||||||
endforeach() |
|
||||||
endif() |
|
||||||
if(MINGWSEARCH_PREFIXES) |
|
||||||
list(APPEND CMAKE_PREFIX_PATH ${MINGWSEARCH_PREFIXES}) |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
|
|
||||||
# Invoke pkgconfig for hints |
|
||||||
find_package(PkgConfig QUIET) |
|
||||||
set(SDL2_ttf_INCLUDE_HINTS) |
|
||||||
set(SDL2_ttf_LIB_HINTS) |
|
||||||
if(PKG_CONFIG_FOUND) |
|
||||||
pkg_search_module(SDL2_ttfPC QUIET SDL2_ttf) |
|
||||||
if(SDL2_ttfPC_INCLUDE_DIRS) |
|
||||||
set(SDL2_ttf_INCLUDE_HINTS ${SDL2_ttfPC_INCLUDE_DIRS}) |
|
||||||
endif() |
|
||||||
if(SDL2_ttfPC_LIBRARY_DIRS) |
|
||||||
set(SDL2_ttf_LIB_HINTS ${SDL2_ttfPC_LIBRARY_DIRS}) |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs) |
|
||||||
|
|
||||||
find_library(SDL2_ttf_LIBRARY |
|
||||||
NAMES |
|
||||||
SDL2_ttf |
|
||||||
HINTS |
|
||||||
${SDL2_ttf_LIB_HINTS} |
|
||||||
PATHS |
|
||||||
${SDL2_ttf_ROOT_DIR} |
|
||||||
ENV SDL2DIR |
|
||||||
PATH_SUFFIXES lib SDL2 ${SDL2_ttf_LIB_PATH_SUFFIX}) |
|
||||||
|
|
||||||
set(_sdl2_framework FALSE) |
|
||||||
# Some special-casing if we've found/been given a framework. |
|
||||||
# Handles whether we're given the library inside the framework or the framework itself. |
|
||||||
if(APPLE AND "${SDL2_ttf_LIBRARY}" MATCHES "(/[^/]+)*.framework(/.*)?$") |
|
||||||
set(_sdl2_framework TRUE) |
|
||||||
set(SDL2_ttf_FRAMEWORK "${SDL2_ttf_LIBRARY}") |
|
||||||
# Move up in the directory tree as required to get the framework directory. |
|
||||||
while("${SDL2_ttf_FRAMEWORK}" MATCHES "(/[^/]+)*.framework(/.*)$" AND NOT "${SDL2_ttf_FRAMEWORK}" MATCHES "(/[^/]+)*.framework$") |
|
||||||
get_filename_component(SDL2_ttf_FRAMEWORK "${SDL2_ttf_FRAMEWORK}" DIRECTORY) |
|
||||||
endwhile() |
|
||||||
if("${SDL2_ttf_FRAMEWORK}" MATCHES "(/[^/]+)*.framework$") |
|
||||||
set(SDL2_ttf_FRAMEWORK_NAME ${CMAKE_MATCH_1}) |
|
||||||
# If we found a framework, do a search for the header ahead of time that will be more likely to get the framework header. |
|
||||||
find_path(SDL2_ttf_INCLUDE_DIR |
|
||||||
NAMES |
|
||||||
SDL_ttf.h |
|
||||||
HINTS |
|
||||||
"${SDL2_ttf_FRAMEWORK}/Headers/") |
|
||||||
else() |
|
||||||
# For some reason we couldn't get the framework directory itself. |
|
||||||
# Shouldn't happen, but might if something is weird. |
|
||||||
unset(SDL2_ttf_FRAMEWORK) |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
|
|
||||||
find_path(SDL2_ttf_INCLUDE_DIR |
|
||||||
NAMES |
|
||||||
SDL_ttf.h |
|
||||||
HINTS |
|
||||||
${SDL2_ttf_INCLUDE_HINTS} |
|
||||||
PATHS |
|
||||||
${SDL2_ttf_ROOT_DIR} |
|
||||||
ENV SDL2DIR |
|
||||||
PATH_SUFFIXES include include/sdl2 include/SDL2 SDL2) |
|
||||||
|
|
||||||
if(WIN32 AND SDL2_ttf_LIBRARY) |
|
||||||
find_file(SDL2_ttf_RUNTIME_LIBRARY |
|
||||||
NAMES |
|
||||||
SDL2_ttf.dll |
|
||||||
libSDL2_ttf.dll |
|
||||||
HINTS |
|
||||||
${SDL2_ttf_LIB_HINTS} |
|
||||||
PATHS |
|
||||||
${SDL2_ttf_ROOT_DIR} |
|
||||||
ENV SDL2DIR |
|
||||||
PATH_SUFFIXES bin lib ${SDL2_ttf_LIB_PATH_SUFFIX}) |
|
||||||
endif() |
|
||||||
|
|
||||||
if(MINGW AND NOT SDL2_ttfPC_FOUND) |
|
||||||
find_library(SDL2_ttf_MINGW_LIBRARY mingw32) |
|
||||||
find_library(SDL2_ttf_MWINDOWS_LIBRARY mwindows) |
|
||||||
endif() |
|
||||||
|
|
||||||
if(SDL2_ttf_PREFIX) |
|
||||||
# Restore things the way they used to be. |
|
||||||
set(CMAKE_PREFIX_PATH ${SDL2_ttf_ORIGPREFIXPATH}) |
|
||||||
endif() |
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set QUATLIB_FOUND to TRUE if |
|
||||||
# all listed variables are TRUE |
|
||||||
include(FindPackageHandleStandardArgs) |
|
||||||
find_package_handle_standard_args(SDL2_ttf |
|
||||||
DEFAULT_MSG |
|
||||||
SDL2_ttf_LIBRARY |
|
||||||
SDL2_ttf_INCLUDE_DIR |
|
||||||
${SDL2_ttf_EXTRA_REQUIRED}) |
|
||||||
|
|
||||||
if(SDL2_ttf_FOUND) |
|
||||||
if(NOT TARGET SDL2::SDL2_ttf) |
|
||||||
# Create SDL2::SDL2_ttf |
|
||||||
if(WIN32 AND SDL2_ttf_RUNTIME_LIBRARY) |
|
||||||
set(SDL2_ttf_DYNAMIC TRUE) |
|
||||||
add_library(SDL2::SDL2_ttf SHARED IMPORTED) |
|
||||||
set_target_properties(SDL2::SDL2_ttf |
|
||||||
PROPERTIES |
|
||||||
IMPORTED_IMPLIB "${SDL2_ttf_LIBRARY}" |
|
||||||
IMPORTED_LOCATION "${SDL2_ttf_RUNTIME_LIBRARY}" |
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_ttf_INCLUDE_DIR}" |
|
||||||
) |
|
||||||
else() |
|
||||||
add_library(SDL2::SDL2_ttf UNKNOWN IMPORTED) |
|
||||||
if(SDL2_ttf_FRAMEWORK AND SDL2_ttf_FRAMEWORK_NAME) |
|
||||||
# Handle the case that SDL2_ttf is a framework and we were able to decompose it above. |
|
||||||
set_target_properties(SDL2::SDL2_ttf PROPERTIES |
|
||||||
IMPORTED_LOCATION "${SDL2_ttf_FRAMEWORK}/${SDL2_ttf_FRAMEWORK_NAME}") |
|
||||||
elseif(_sdl2_framework AND SDL2_ttf_LIBRARY MATCHES "(/[^/]+)*.framework$") |
|
||||||
# Handle the case that SDL2_ttf is a framework and SDL_LIBRARY is just the framework itself. |
|
||||||
|
|
||||||
# This takes the basename of the framework, without the extension, |
|
||||||
# and sets it (as a child of the framework) as the imported location for the target. |
|
||||||
# This is the library symlink inside of the framework. |
|
||||||
set_target_properties(SDL2::SDL2_ttf PROPERTIES |
|
||||||
IMPORTED_LOCATION "${SDL2_ttf_LIBRARY}/${CMAKE_MATCH_1}") |
|
||||||
else() |
|
||||||
# Handle non-frameworks (including non-Mac), as well as the case that we're given the library inside of the framework |
|
||||||
set_target_properties(SDL2::SDL2_ttf PROPERTIES |
|
||||||
IMPORTED_LOCATION "${SDL2_ttf_LIBRARY}") |
|
||||||
endif() |
|
||||||
set_target_properties(SDL2::SDL2_ttf |
|
||||||
PROPERTIES |
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_ttf_INCLUDE_DIR}" |
|
||||||
) |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
mark_as_advanced(SDL2_ttf_ROOT_DIR) |
|
||||||
endif() |
|
||||||
|
|
||||||
mark_as_advanced(SDL2_ttf_LIBRARY |
|
||||||
SDL2_ttf_RUNTIME_LIBRARY |
|
||||||
SDL2_ttf_INCLUDE_DIR |
|
||||||
SDL2_ttf_SDLMAIN_LIBRARY |
|
||||||
SDL2_ttf_COCOA_LIBRARY |
|
||||||
SDL2_ttf_MINGW_LIBRARY |
|
||||||
SDL2_ttf_MWINDOWS_LIBRARY) |
|
||||||
|
|
||||||
find_package(SDL2 REQUIRED) |
|
||||||
set_property(TARGET SDL2::SDL2_ttf APPEND PROPERTY |
|
||||||
INTERFACE_LINK_LIBRARIES SDL2::SDL2) |
|
||||||
@ -1,65 +0,0 @@ |
|||||||
# - Try to find BZip2 |
|
||||||
# You can set BZIP2_ROOT to specify a certain directory to look in first. |
|
||||||
# Once done this will define |
|
||||||
# BZIP2_FOUND - System has BZip2 |
|
||||||
# BZIP2_INCLUDE_DIRS - The BZip2 include directories |
|
||||||
# BZIP2_LIBRARIES - The libraries needed to use BZip2 |
|
||||||
# Unless we are unable to find ZLIB |
|
||||||
# It also adds an imported target named `3ds::bzip2`, Linking against it is |
|
||||||
# equivalent to: |
|
||||||
# target_link_libraries(mytarget ${BZIP2_LIBRARIES}) |
|
||||||
# target_include_directories(mytarget PRIVATE ${BZIP2_INCLUDE_DIRS}) |
|
||||||
|
|
||||||
if(NOT NINTENDO_3DS) |
|
||||||
message(FATAL_ERROR "This module can only be used if you are using the 3DS toolchain file. Please erase this build directory or create another one, and then use -DCMAKE_TOOLCHAIN_FILE=DevkitArm3DS.cmake when calling cmake for the 1st time. For more information, see the Readme.md for more information.") |
|
||||||
endif() |
|
||||||
|
|
||||||
if(BZIP2_INCLUDE_DIR) |
|
||||||
# Already in cache, be silent |
|
||||||
set(BZIP2_FIND_QUIETLY TRUE) |
|
||||||
endif(BZIP2_INCLUDE_DIR) |
|
||||||
|
|
||||||
include(LibFindMacros) |
|
||||||
include(try_add_imported_target) |
|
||||||
|
|
||||||
#libfind_package(BZIP2) |
|
||||||
|
|
||||||
set(_BZIP2_SEARCHES) |
|
||||||
|
|
||||||
# Search BZIP2_ROOT first if it is set. |
|
||||||
if(BZIP2_ROOT) |
|
||||||
set(_BZIP2_SEARCH_ROOT |
|
||||||
PATHS ${BZIP2_ROOT} |
|
||||||
NO_DEFAULT_PATH |
|
||||||
NO_CMAKE_FIND_ROOT_PATH) |
|
||||||
list(APPEND _BZIP2_SEARCHES _BZIP2_SEARCH_ROOT) |
|
||||||
endif() |
|
||||||
|
|
||||||
# Search below ${DEVKITPRO}, ${DEVKITARM}, portlibs (if enabled) etc. |
|
||||||
set(_BZIP2_SEARCH_NORMAL |
|
||||||
PATHS / |
|
||||||
NO_DEFAULT_PATH |
|
||||||
ONLY_CMAKE_FIND_ROOT_PATH) |
|
||||||
list(APPEND _BZIP2_SEARCHES _BZIP2_SEARCH_NORMAL) |
|
||||||
|
|
||||||
foreach(search ${_BZIP2_SEARCHES}) |
|
||||||
find_path(BZIP2_INCLUDE_DIR NAMES bzlib.h |
|
||||||
${${search}} |
|
||||||
PATH_SUFFIXES include) |
|
||||||
find_library(BZIP2_LIBRARY NAMES bzip2 libbz2.a |
|
||||||
${${search}} |
|
||||||
PATH_SUFFIXES lib) |
|
||||||
endforeach() |
|
||||||
|
|
||||||
#find_library(LIBM_LIBRARY NAMES m libm.a |
|
||||||
# PATHS / /arm-none-eabi |
|
||||||
# PATH_SUFFIXES lib/armv6k/fpu) |
|
||||||
|
|
||||||
set(LIBM_LIBRARY m) |
|
||||||
|
|
||||||
set(BZIP2_PROCESS_INCLUDES BZIP2_INCLUDE_DIR) |
|
||||||
set(BZIP2_PROCESS_LIBS BZIP2_LIBRARY LIBM_LIBRARY) |
|
||||||
|
|
||||||
libfind_process(BZIP2) |
|
||||||
|
|
||||||
try_add_imported_target(BZIP2 m) |
|
||||||
@ -1,59 +0,0 @@ |
|||||||
# - Try to find freetype |
|
||||||
# You can set FREETYPE_ROOT to specify a certain directory to look in first. |
|
||||||
# Once done this will define |
|
||||||
# FREETYPE_FOUND - System has freetype |
|
||||||
# FREETYPE_INCLUDE_DIRS - The freetype include directories |
|
||||||
# FREETYPE_LIBRARIES - The libraries needed to use freetype |
|
||||||
# Unless we are unable to find ZLIB |
|
||||||
# It also adds an imported target named `3ds::freetype`, Linking against it is |
|
||||||
# equivalent to: |
|
||||||
# target_link_libraries(mytarget ${FREETYPE_LIBRARIES}) |
|
||||||
# target_include_directories(mytarget PRIVATE ${FREETYPE_INCLUDE_DIRS}) |
|
||||||
|
|
||||||
if(NOT NINTENDO_3DS) |
|
||||||
message(FATAL_ERROR "This module can only be used if you are using the 3DS toolchain file. Please erase this build directory or create another one, and then use -DCMAKE_TOOLCHAIN_FILE=DevkitArm3DS.cmake when calling cmake for the 1st time. For more information, see the Readme.md for more information.") |
|
||||||
endif() |
|
||||||
|
|
||||||
if(FREETYPE_INCLUDE_DIR) |
|
||||||
# Already in cache, be silent |
|
||||||
set(FREETYPE_FIND_QUIETLY TRUE) |
|
||||||
endif(FREETYPE_INCLUDE_DIR) |
|
||||||
|
|
||||||
include(LibFindMacros) |
|
||||||
include(try_add_imported_target) |
|
||||||
|
|
||||||
libfind_package(FREETYPE ZLIB) |
|
||||||
|
|
||||||
set(_FREETYPE_SEARCHES) |
|
||||||
|
|
||||||
# Search FREETYPE_ROOT first if it is set. |
|
||||||
if(FREETYPE_ROOT) |
|
||||||
set(_FREETYPE_SEARCH_ROOT |
|
||||||
PATHS ${FREETYPE_ROOT} |
|
||||||
NO_DEFAULT_PATH |
|
||||||
NO_CMAKE_FIND_ROOT_PATH) |
|
||||||
list(APPEND _FREETYPE_SEARCHES _FREETYPE_SEARCH_ROOT) |
|
||||||
endif() |
|
||||||
|
|
||||||
# Search below ${DEVKITPRO}, ${DEVKITARM}, portlibs (if enabled) etc. |
|
||||||
set(_FREETYPE_SEARCH_NORMAL |
|
||||||
PATHS / |
|
||||||
NO_DEFAULT_PATH |
|
||||||
ONLY_CMAKE_FIND_ROOT_PATH) |
|
||||||
list(APPEND _FREETYPE_SEARCHES _FREETYPE_SEARCH_NORMAL) |
|
||||||
|
|
||||||
foreach(search ${_FREETYPE_SEARCHES}) |
|
||||||
find_path(FREETYPE_INCLUDE_DIR NAMES freetype/config/ftheader.h config/ftheader.h |
|
||||||
${${search}} |
|
||||||
PATH_SUFFIXES include/freetype2 include freetype2) |
|
||||||
find_library(FREETYPE_LIBRARY NAMES freetype libfreetype.a |
|
||||||
${${search}} |
|
||||||
PATH_SUFFIXES lib) |
|
||||||
endforeach() |
|
||||||
|
|
||||||
set(FREETYPE_PROCESS_INCLUDES FREETYPE_INCLUDE_DIR) |
|
||||||
set(FREETYPE_PROCESS_LIBS FREETYPE_LIBRARY) |
|
||||||
|
|
||||||
libfind_process(FREETYPE) |
|
||||||
|
|
||||||
try_add_imported_target(FREETYPE 3ds::zlib) |
|
||||||
Binary file not shown.
@ -1,46 +0,0 @@ |
|||||||
Digitized data copyright (c) 2010 Google Corporation |
|
||||||
with Reserved Font Arimo, Tinos and Cousine. |
|
||||||
Copyright (c) 2012 Red Hat, Inc. |
|
||||||
with Reserved Font Name Liberation. |
|
||||||
|
|
||||||
This Font Software is licensed under the SIL Open Font License, Version 1.1. |
|
||||||
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL |
|
||||||
|
|
||||||
----------------------------------------------------------- |
|
||||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 |
|
||||||
----------------------------------------------------------- |
|
||||||
|
|
||||||
PREAMBLE |
|
||||||
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. |
|
||||||
|
|
||||||
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. |
|
||||||
|
|
||||||
DEFINITIONS |
|
||||||
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. |
|
||||||
|
|
||||||
"Reserved Font Name" refers to any names specified as such after the copyright statement(s). |
|
||||||
|
|
||||||
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). |
|
||||||
|
|
||||||
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. |
|
||||||
|
|
||||||
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. |
|
||||||
|
|
||||||
PERMISSION & CONDITIONS |
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: |
|
||||||
|
|
||||||
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. |
|
||||||
|
|
||||||
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. |
|
||||||
|
|
||||||
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. |
|
||||||
|
|
||||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. |
|
||||||
|
|
||||||
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. |
|
||||||
|
|
||||||
TERMINATION |
|
||||||
This license becomes null and void if any of the above conditions are not met. |
|
||||||
|
|
||||||
DISCLAIMER |
|
||||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. |
|
||||||
@ -1,2 +1,2 @@ |
|||||||
#!/bin/sh |
#!/bin/sh |
||||||
exec "$APPDIR/usr/bin/devilutionx" --ttf-dir "$APPDIR/usr/share/fonts/truetype/" "$@" |
exec "$APPDIR/usr/bin/devilutionx" "$@" |
||||||
|
|||||||
Binary file not shown.
@ -1,173 +0,0 @@ |
|||||||
The source code to this library used with SDL_ttf can be found here: |
|
||||||
https://hg.libsdl.org/SDL_ttf/file/default/external |
|
||||||
--- |
|
||||||
|
|
||||||
The FreeType Project LICENSE |
|
||||||
---------------------------- |
|
||||||
|
|
||||||
2006-Jan-27 |
|
||||||
|
|
||||||
Copyright 1996-2002, 2006 by |
|
||||||
David Turner, Robert Wilhelm, and Werner Lemberg |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Introduction |
|
||||||
============ |
|
||||||
|
|
||||||
The FreeType Project is distributed in several archive packages; |
|
||||||
some of them may contain, in addition to the FreeType font engine, |
|
||||||
various tools and contributions which rely on, or relate to, the |
|
||||||
FreeType Project. |
|
||||||
|
|
||||||
This license applies to all files found in such packages, and |
|
||||||
which do not fall under their own explicit license. The license |
|
||||||
affects thus the FreeType font engine, the test programs, |
|
||||||
documentation and makefiles, at the very least. |
|
||||||
|
|
||||||
This license was inspired by the BSD, Artistic, and IJG |
|
||||||
(Independent JPEG Group) licenses, which all encourage inclusion |
|
||||||
and use of free software in commercial and freeware products |
|
||||||
alike. As a consequence, its main points are that: |
|
||||||
|
|
||||||
o We don't promise that this software works. However, we will be |
|
||||||
interested in any kind of bug reports. (`as is' distribution) |
|
||||||
|
|
||||||
o You can use this software for whatever you want, in parts or |
|
||||||
full form, without having to pay us. (`royalty-free' usage) |
|
||||||
|
|
||||||
o You may not pretend that you wrote this software. If you use |
|
||||||
it, or only parts of it, in a program, you must acknowledge |
|
||||||
somewhere in your documentation that you have used the |
|
||||||
FreeType code. (`credits') |
|
||||||
|
|
||||||
We specifically permit and encourage the inclusion of this |
|
||||||
software, with or without modifications, in commercial products. |
|
||||||
We disclaim all warranties covering The FreeType Project and |
|
||||||
assume no liability related to The FreeType Project. |
|
||||||
|
|
||||||
|
|
||||||
Finally, many people asked us for a preferred form for a |
|
||||||
credit/disclaimer to use in compliance with this license. We thus |
|
||||||
encourage you to use the following text: |
|
||||||
|
|
||||||
""" |
|
||||||
Portions of this software are copyright © <year> The FreeType |
|
||||||
Project (www.freetype.org). All rights reserved. |
|
||||||
""" |
|
||||||
|
|
||||||
Please replace <year> with the value from the FreeType version you |
|
||||||
actually use. |
|
||||||
|
|
||||||
|
|
||||||
Legal Terms |
|
||||||
=========== |
|
||||||
|
|
||||||
0. Definitions |
|
||||||
-------------- |
|
||||||
|
|
||||||
Throughout this license, the terms `package', `FreeType Project', |
|
||||||
and `FreeType archive' refer to the set of files originally |
|
||||||
distributed by the authors (David Turner, Robert Wilhelm, and |
|
||||||
Werner Lemberg) as the `FreeType Project', be they named as alpha, |
|
||||||
beta or final release. |
|
||||||
|
|
||||||
`You' refers to the licensee, or person using the project, where |
|
||||||
`using' is a generic term including compiling the project's source |
|
||||||
code as well as linking it to form a `program' or `executable'. |
|
||||||
This program is referred to as `a program using the FreeType |
|
||||||
engine'. |
|
||||||
|
|
||||||
This license applies to all files distributed in the original |
|
||||||
FreeType Project, including all source code, binaries and |
|
||||||
documentation, unless otherwise stated in the file in its |
|
||||||
original, unmodified form as distributed in the original archive. |
|
||||||
If you are unsure whether or not a particular file is covered by |
|
||||||
this license, you must contact us to verify this. |
|
||||||
|
|
||||||
The FreeType Project is copyright (C) 1996-2000 by David Turner, |
|
||||||
Robert Wilhelm, and Werner Lemberg. All rights reserved except as |
|
||||||
specified below. |
|
||||||
|
|
||||||
1. No Warranty |
|
||||||
-------------- |
|
||||||
|
|
||||||
THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY |
|
||||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
||||||
PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS |
|
||||||
BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO |
|
||||||
USE, OF THE FREETYPE PROJECT. |
|
||||||
|
|
||||||
2. Redistribution |
|
||||||
----------------- |
|
||||||
|
|
||||||
This license grants a worldwide, royalty-free, perpetual and |
|
||||||
irrevocable right and license to use, execute, perform, compile, |
|
||||||
display, copy, create derivative works of, distribute and |
|
||||||
sublicense the FreeType Project (in both source and object code |
|
||||||
forms) and derivative works thereof for any purpose; and to |
|
||||||
authorize others to exercise some or all of the rights granted |
|
||||||
herein, subject to the following conditions: |
|
||||||
|
|
||||||
o Redistribution of source code must retain this license file |
|
||||||
(`FTL.TXT') unaltered; any additions, deletions or changes to |
|
||||||
the original files must be clearly indicated in accompanying |
|
||||||
documentation. The copyright notices of the unaltered, |
|
||||||
original files must be preserved in all copies of source |
|
||||||
files. |
|
||||||
|
|
||||||
o Redistribution in binary form must provide a disclaimer that |
|
||||||
states that the software is based in part of the work of the |
|
||||||
FreeType Team, in the distribution documentation. We also |
|
||||||
encourage you to put an URL to the FreeType web page in your |
|
||||||
documentation, though this isn't mandatory. |
|
||||||
|
|
||||||
These conditions apply to any software derived from or based on |
|
||||||
the FreeType Project, not just the unmodified files. If you use |
|
||||||
our work, you must acknowledge us. However, no fee need be paid |
|
||||||
to us. |
|
||||||
|
|
||||||
3. Advertising |
|
||||||
-------------- |
|
||||||
|
|
||||||
Neither the FreeType authors and contributors nor you shall use |
|
||||||
the name of the other for commercial, advertising, or promotional |
|
||||||
purposes without specific prior written permission. |
|
||||||
|
|
||||||
We suggest, but do not require, that you use one or more of the |
|
||||||
following phrases to refer to this software in your documentation |
|
||||||
or advertising materials: `FreeType Project', `FreeType Engine', |
|
||||||
`FreeType library', or `FreeType Distribution'. |
|
||||||
|
|
||||||
As you have not signed this license, you are not required to |
|
||||||
accept it. However, as the FreeType Project is copyrighted |
|
||||||
material, only this license, or another one contracted with the |
|
||||||
authors, grants you the right to use, distribute, and modify it. |
|
||||||
Therefore, by using, distributing, or modifying the FreeType |
|
||||||
Project, you indicate that you understand and accept all the terms |
|
||||||
of this license. |
|
||||||
|
|
||||||
4. Contacts |
|
||||||
----------- |
|
||||||
|
|
||||||
There are two mailing lists related to FreeType: |
|
||||||
|
|
||||||
o freetype@nongnu.org |
|
||||||
|
|
||||||
Discusses general use and applications of FreeType, as well as |
|
||||||
future and wanted additions to the library and distribution. |
|
||||||
If you are looking for support, start in this list if you |
|
||||||
haven't found anything to help you in the documentation. |
|
||||||
|
|
||||||
o freetype-devel@nongnu.org |
|
||||||
|
|
||||||
Discusses bugs, as well as engine internals, design issues, |
|
||||||
specific licenses, porting, etc. |
|
||||||
|
|
||||||
Our home page can be found at |
|
||||||
|
|
||||||
https://www.freetype.org |
|
||||||
|
|
||||||
|
|
||||||
--- end of FTL.TXT --- |
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,53 +0,0 @@ |
|||||||
#include "DiabloUI/fonts.h" |
|
||||||
|
|
||||||
#include "diablo.h" |
|
||||||
#include "engine/load_file.hpp" |
|
||||||
#include "utils/file_util.h" |
|
||||||
#include "utils/log.hpp" |
|
||||||
#include "utils/paths.h" |
|
||||||
|
|
||||||
namespace devilution { |
|
||||||
|
|
||||||
TTF_Font *font = nullptr; |
|
||||||
/** This is so we know ttf has been init when we get to the diablo_deinit() function */ |
|
||||||
bool was_fonts_init = false; |
|
||||||
|
|
||||||
void LoadTtfFont() |
|
||||||
{ |
|
||||||
if (TTF_WasInit() == 0) { |
|
||||||
if (TTF_Init() == -1) { |
|
||||||
Log("TTF_Init: {}", TTF_GetError()); |
|
||||||
diablo_quit(1); |
|
||||||
} |
|
||||||
was_fonts_init = true; |
|
||||||
} |
|
||||||
|
|
||||||
std::string ttfFontPath = paths::TtfPath() + paths::TtfName(); |
|
||||||
#if defined(__linux__) && !defined(__ANDROID__) |
|
||||||
if (!FileExists(ttfFontPath.c_str())) { |
|
||||||
ttfFontPath = "/usr/share/fonts/truetype/" + paths::TtfName(); |
|
||||||
} |
|
||||||
#endif |
|
||||||
font = TTF_OpenFont(ttfFontPath.c_str(), 17); |
|
||||||
if (font == nullptr) { |
|
||||||
Log("TTF_OpenFont: {}", TTF_GetError()); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
TTF_SetFontKerning(font, 0); |
|
||||||
TTF_SetFontHinting(font, TTF_HINTING_MONO); |
|
||||||
} |
|
||||||
|
|
||||||
void UnloadTtfFont() |
|
||||||
{ |
|
||||||
if (font != nullptr && TTF_WasInit() != 0) |
|
||||||
TTF_CloseFont(font); |
|
||||||
font = nullptr; |
|
||||||
} |
|
||||||
|
|
||||||
void FontsCleanup() |
|
||||||
{ |
|
||||||
TTF_Quit(); |
|
||||||
} |
|
||||||
|
|
||||||
} // namespace devilution
|
|
||||||
@ -1,18 +0,0 @@ |
|||||||
#pragma once |
|
||||||
|
|
||||||
#include <cstdint> |
|
||||||
#include <memory> |
|
||||||
|
|
||||||
#include <SDL_ttf.h> |
|
||||||
|
|
||||||
#include "DiabloUI/art.h" |
|
||||||
|
|
||||||
namespace devilution { |
|
||||||
|
|
||||||
extern TTF_Font *font; |
|
||||||
|
|
||||||
void LoadTtfFont(); |
|
||||||
void UnloadTtfFont(); |
|
||||||
void FontsCleanup(); |
|
||||||
|
|
||||||
} // namespace devilution
|
|
||||||
@ -1,67 +0,0 @@ |
|||||||
#include "DiabloUI/text_draw.h" |
|
||||||
|
|
||||||
#include "DiabloUI/art_draw.h" |
|
||||||
#include "DiabloUI/diabloui.h" |
|
||||||
#include "DiabloUI/fonts.h" |
|
||||||
#include "DiabloUI/ttf_render_wrapped.h" |
|
||||||
#include "DiabloUI/ui_item.h" |
|
||||||
#include "utils/display.h" |
|
||||||
|
|
||||||
namespace devilution { |
|
||||||
|
|
||||||
namespace { |
|
||||||
|
|
||||||
TextAlignment XAlignmentFromFlags(UiFlags flags) |
|
||||||
{ |
|
||||||
if (HasAnyOf(flags, UiFlags::AlignCenter)) |
|
||||||
return TextAlignment_CENTER; |
|
||||||
if (HasAnyOf(flags, UiFlags::AlignRight)) |
|
||||||
return TextAlignment_END; |
|
||||||
return TextAlignment_BEGIN; |
|
||||||
} |
|
||||||
|
|
||||||
int AlignXOffset(UiFlags flags, const SDL_Rect &dest, int w) |
|
||||||
{ |
|
||||||
if (HasAnyOf(flags, UiFlags::AlignCenter)) |
|
||||||
return (dest.w - w) / 2; |
|
||||||
if (HasAnyOf(flags, UiFlags::AlignRight)) |
|
||||||
return dest.w - w; |
|
||||||
return 0; |
|
||||||
} |
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
void DrawTTF(const char *text, const SDL_Rect &rectIn, UiFlags flags, |
|
||||||
const SDL_Color &textColor, const SDL_Color &shadowColor, |
|
||||||
TtfSurfaceCache &renderCache) |
|
||||||
{ |
|
||||||
SDL_Rect rect(rectIn); |
|
||||||
if (font == nullptr || text == nullptr || *text == '\0') |
|
||||||
return; |
|
||||||
|
|
||||||
const auto xAlign = XAlignmentFromFlags(flags); |
|
||||||
if (renderCache.text == nullptr) |
|
||||||
renderCache.text = ScaleSurfaceToOutput(RenderUTF8_Solid_Wrapped(font, text, textColor, rect.w, xAlign)); |
|
||||||
if (renderCache.shadow == nullptr) |
|
||||||
renderCache.shadow = ScaleSurfaceToOutput(RenderUTF8_Solid_Wrapped(font, text, shadowColor, rect.w, xAlign)); |
|
||||||
|
|
||||||
SDL_Surface *textSurface = renderCache.text.get(); |
|
||||||
SDL_Surface *shadowSurface = renderCache.shadow.get(); |
|
||||||
if (textSurface == nullptr) |
|
||||||
return; |
|
||||||
|
|
||||||
SDL_Rect destRect = rect; |
|
||||||
ScaleOutputRect(&destRect); |
|
||||||
destRect.x += AlignXOffset(flags, destRect, textSurface->w); |
|
||||||
destRect.y += HasAnyOf(flags, UiFlags::VerticalCenter) ? (destRect.h - textSurface->h) / 2 : 0; |
|
||||||
|
|
||||||
SDL_Rect shadowRect = destRect; |
|
||||||
++shadowRect.x; |
|
||||||
++shadowRect.y; |
|
||||||
if (SDL_BlitSurface(shadowSurface, nullptr, DiabloUiSurface(), &shadowRect) < 0) |
|
||||||
ErrSdl(); |
|
||||||
if (SDL_BlitSurface(textSurface, nullptr, DiabloUiSurface(), &destRect) < 0) |
|
||||||
ErrSdl(); |
|
||||||
} |
|
||||||
|
|
||||||
} // namespace devilution
|
|
||||||
@ -1,20 +0,0 @@ |
|||||||
#pragma once |
|
||||||
|
|
||||||
#include <SDL.h> |
|
||||||
|
|
||||||
#include "utils/sdl_ptrs.h" |
|
||||||
|
|
||||||
namespace devilution { |
|
||||||
|
|
||||||
struct TtfSurfaceCache { |
|
||||||
SDLSurfaceUniquePtr text; |
|
||||||
SDLSurfaceUniquePtr shadow; |
|
||||||
}; |
|
||||||
|
|
||||||
enum class UiFlags; // Defined in ui_item.h, declared here to avoid circular dependency
|
|
||||||
|
|
||||||
void DrawTTF(const char *text, const SDL_Rect &rect, UiFlags flags, |
|
||||||
const SDL_Color &textColor, const SDL_Color &shadowColor, |
|
||||||
TtfSurfaceCache &renderCache); |
|
||||||
|
|
||||||
} // namespace devilution
|
|
||||||
@ -1,154 +0,0 @@ |
|||||||
#include "DiabloUI/ttf_render_wrapped.h" |
|
||||||
|
|
||||||
#include <cstddef> |
|
||||||
#include <cstring> |
|
||||||
#include <vector> |
|
||||||
#include <algorithm> |
|
||||||
|
|
||||||
#include <SDL.h> |
|
||||||
#ifdef USE_SDL1 |
|
||||||
#include "utils/sdl2_to_1_2_backports.h" |
|
||||||
#else |
|
||||||
#include "utils/sdl2_backports.h" |
|
||||||
#endif |
|
||||||
|
|
||||||
#include "utils/log.hpp" |
|
||||||
#include "utils/sdl_compat.h" |
|
||||||
#include "utils/sdl_wrap.h" |
|
||||||
#include "utils/ttf_wrap.h" |
|
||||||
|
|
||||||
namespace devilution { |
|
||||||
|
|
||||||
namespace { |
|
||||||
|
|
||||||
bool CharacterIsDelimiter(char c) |
|
||||||
{ |
|
||||||
constexpr char Delimiters[] = { ' ', '\t', '\r', '\n' }; |
|
||||||
|
|
||||||
return std::find(std::begin(Delimiters), std::end(Delimiters), c) != std::end(Delimiters); |
|
||||||
} |
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
// Based on SDL 2.0.12 TTF_RenderUTF8_Blended_Wrapped
|
|
||||||
SDLSurfaceUniquePtr RenderUTF8_Solid_Wrapped(TTF_Font *font, const char *text, SDL_Color fg, Uint32 wrapLength, const int xAlign) |
|
||||||
{ |
|
||||||
int width = 0; |
|
||||||
int height = 0; |
|
||||||
const int lineSpace = 2; |
|
||||||
|
|
||||||
/* Get the dimensions of the text surface */ |
|
||||||
if (TTF_SizeUTF8(font, text, &width, &height) < 0 || width == 0) { |
|
||||||
TTF_SetError("Text has zero width"); |
|
||||||
return {}; |
|
||||||
} |
|
||||||
|
|
||||||
std::unique_ptr<char[]> str; |
|
||||||
std::vector<char *> strLines; |
|
||||||
if (wrapLength > 0 && *text != '\0') { |
|
||||||
const std::size_t strLen = std::strlen(text); |
|
||||||
|
|
||||||
str.reset(new char[strLen + 1]); |
|
||||||
|
|
||||||
std::memcpy(str.get(), text, strLen + 1); |
|
||||||
char *tok = str.get(); |
|
||||||
char *end = str.get() + strLen; |
|
||||||
do { |
|
||||||
strLines.push_back(tok); |
|
||||||
|
|
||||||
/* Look for the end of the line */ |
|
||||||
char *spot; |
|
||||||
if ((spot = SDL_strchr(tok, '\r')) != nullptr || (spot = SDL_strchr(tok, '\n')) != nullptr) { |
|
||||||
if (*spot == '\r') { |
|
||||||
++spot; |
|
||||||
} |
|
||||||
if (*spot == '\n') { |
|
||||||
++spot; |
|
||||||
} |
|
||||||
} else { |
|
||||||
spot = end; |
|
||||||
} |
|
||||||
char *nextTok = spot; |
|
||||||
|
|
||||||
/* Get the longest string that will fit in the desired space */ |
|
||||||
for (;;) { |
|
||||||
/* Strip trailing whitespace */ |
|
||||||
while (spot > tok && CharacterIsDelimiter(spot[-1])) { |
|
||||||
--spot; |
|
||||||
} |
|
||||||
if (spot == tok) { |
|
||||||
if (CharacterIsDelimiter(*spot)) { |
|
||||||
*spot = '\0'; |
|
||||||
} |
|
||||||
break; |
|
||||||
} |
|
||||||
char delim = *spot; |
|
||||||
*spot = '\0'; |
|
||||||
|
|
||||||
int w = 0; |
|
||||||
int h = 0; |
|
||||||
TTF_SizeUTF8(font, tok, &w, &h); |
|
||||||
if ((Uint32)w <= wrapLength) { |
|
||||||
break; |
|
||||||
} |
|
||||||
/* Back up and try again... */ |
|
||||||
*spot = delim; |
|
||||||
|
|
||||||
while (spot > tok && !CharacterIsDelimiter(spot[-1])) { |
|
||||||
--spot; |
|
||||||
} |
|
||||||
if (spot > tok) { |
|
||||||
nextTok = spot; |
|
||||||
} |
|
||||||
} |
|
||||||
tok = nextTok; |
|
||||||
} while (tok < end); |
|
||||||
} |
|
||||||
|
|
||||||
if (strLines.empty()) |
|
||||||
return TTFWrap::RenderUTF8_Solid(font, text, fg); |
|
||||||
|
|
||||||
/* Create the target surface */ |
|
||||||
auto textbuf = SDLWrap::CreateRGBSurface(SDL_SWSURFACE, (strLines.size() > 1) ? wrapLength : width, height * strLines.size() + (lineSpace * (strLines.size() - 1)), 8, 0, 0, 0, 0); |
|
||||||
|
|
||||||
/* Fill the palette with the foreground color */ |
|
||||||
SDL_Palette *palette = textbuf->format->palette; |
|
||||||
palette->colors[0].r = 255 - fg.r; |
|
||||||
palette->colors[0].g = 255 - fg.g; |
|
||||||
palette->colors[0].b = 255 - fg.b; |
|
||||||
palette->colors[1].r = fg.r; |
|
||||||
palette->colors[1].g = fg.g; |
|
||||||
palette->colors[1].b = fg.b; |
|
||||||
SDLC_SetColorKey(textbuf.get(), 0); |
|
||||||
|
|
||||||
// Reduced space between lines to roughly match Diablo.
|
|
||||||
const int lineskip = TTF_FontLineSkip(font) * 7 / 10; // avoids forced int > float > int conversion
|
|
||||||
SDL_Rect dest = { 0, 0, 0, 0 }; |
|
||||||
for (auto text : strLines) { |
|
||||||
if (*text == '\0') { |
|
||||||
dest.y += lineskip; |
|
||||||
continue; |
|
||||||
} |
|
||||||
SDLSurfaceUniquePtr tmp = TTFWrap::RenderUTF8_Solid(font, text, fg); |
|
||||||
|
|
||||||
dest.w = static_cast<Uint16>(tmp->w); |
|
||||||
dest.h = static_cast<Uint16>(tmp->h); |
|
||||||
|
|
||||||
switch (xAlign) { |
|
||||||
case TextAlignment_END: |
|
||||||
dest.x = textbuf->w - tmp->w; |
|
||||||
break; |
|
||||||
case TextAlignment_CENTER: |
|
||||||
dest.x = (textbuf->w - tmp->w) / 2; |
|
||||||
break; |
|
||||||
case TextAlignment_BEGIN: |
|
||||||
dest.x = 0; |
|
||||||
break; |
|
||||||
} |
|
||||||
SDL_BlitSurface(tmp.get(), nullptr, textbuf.get(), &dest); |
|
||||||
dest.y += lineskip; |
|
||||||
} |
|
||||||
return textbuf; |
|
||||||
} |
|
||||||
|
|
||||||
} // namespace devilution
|
|
||||||
@ -1,24 +0,0 @@ |
|||||||
#pragma once |
|
||||||
|
|
||||||
#include <SDL_ttf.h> |
|
||||||
#include <cstdint> |
|
||||||
#include "utils/sdl_ptrs.h" |
|
||||||
|
|
||||||
namespace devilution { |
|
||||||
|
|
||||||
enum TextAlignment : uint8_t { |
|
||||||
TextAlignment_BEGIN, |
|
||||||
TextAlignment_CENTER, |
|
||||||
TextAlignment_END, |
|
||||||
}; |
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders UTF-8, wrapping lines to avoid exceeding wrapLength, and aligning |
|
||||||
* according to the `x_align` argument. |
|
||||||
* |
|
||||||
* This method is slow. Caching the result is recommended. |
|
||||||
*/ |
|
||||||
SDLSurfaceUniquePtr RenderUTF8_Solid_Wrapped( |
|
||||||
TTF_Font *font, const char *text, SDL_Color fg, Uint32 wrapLength, const int xAlign = TextAlignment_BEGIN); |
|
||||||
|
|
||||||
} // namespace devilution
|
|
||||||
@ -1,29 +0,0 @@ |
|||||||
#pragma once |
|
||||||
|
|
||||||
#include <SDL_ttf.h> |
|
||||||
#include <SDL.h> |
|
||||||
#ifdef USE_SDL1 |
|
||||||
#include "utils/sdl2_to_1_2_backports.h" |
|
||||||
#else |
|
||||||
#include "utils/sdl2_backports.h" |
|
||||||
#endif |
|
||||||
|
|
||||||
#include "appfat.h" |
|
||||||
#include "utils/sdl_ptrs.h" |
|
||||||
|
|
||||||
namespace devilution { |
|
||||||
|
|
||||||
namespace TTFWrap { |
|
||||||
|
|
||||||
inline SDLSurfaceUniquePtr RenderUTF8_Solid(TTF_Font *font, const char *text, SDL_Color fg) |
|
||||||
{ |
|
||||||
SDLSurfaceUniquePtr ret { TTF_RenderUTF8_Solid(font, text, fg) }; |
|
||||||
if (ret == nullptr) |
|
||||||
ErrTtf(); |
|
||||||
|
|
||||||
return ret; |
|
||||||
} |
|
||||||
|
|
||||||
} //namespace TTFWrap
|
|
||||||
|
|
||||||
} //namespace devilution
|
|
||||||
@ -1,16 +0,0 @@ |
|||||||
set(BUILD_SHARED_LIBS ON) |
|
||||||
|
|
||||||
include(FetchContent_MakeAvailableExcludeFromAll) |
|
||||||
include(FetchContent) |
|
||||||
|
|
||||||
FetchContent_Declare(SDL2_ttf |
|
||||||
URL https://github.com/libsdl-org/SDL_ttf/archive/33cdd1881e31184b49a68b4890d1d256fc0c6dc1.tar.gz |
|
||||||
URL_HASH MD5=7cfa28e6170618acf50d6a9cd27091ab |
|
||||||
) |
|
||||||
FetchContent_MakeAvailableExcludeFromAll(SDL2_ttf) |
|
||||||
|
|
||||||
# SDL2_ttf only provides an INSTALL_INTERFACE directory |
|
||||||
# so use the source directory for the BUILD_INTERFACE |
|
||||||
target_include_directories(SDL2_ttf PUBLIC $<BUILD_INTERFACE:${SDL_ttf_SOURCE_DIR}>) |
|
||||||
|
|
||||||
add_library(SDL2::SDL2_ttf ALIAS SDL2_ttf) |
|
||||||
@ -1,9 +0,0 @@ |
|||||||
# Use globbing to find the source directory regardless of the version number |
|
||||||
file(GLOB freetype_SOURCE_DIR ${SDL_ttf_SOURCE_DIR}/external/freetype*) |
|
||||||
add_subdirectory(${freetype_SOURCE_DIR}) |
|
||||||
|
|
||||||
# freetype only provides an INSTALL_INTERFACE directory |
|
||||||
# so use the source directory for the BUILD_INTERFACE |
|
||||||
target_include_directories(freetype PUBLIC $<BUILD_INTERFACE:${freetype_SOURCE_DIR}/include>) |
|
||||||
|
|
||||||
add_library(Freetype::Freetype ALIAS freetype) |
|
||||||
Loading…
Reference in new issue