Add libraries for emoji and complex text
This commit is contained in:
parent
6cc75a106b
commit
43d322c634
@ -30,6 +30,7 @@ addons:
|
||||
- libbluetooth-dev
|
||||
- libcurl4-gnutls-dev
|
||||
- libfreetype6-dev
|
||||
- libharfbuzz-dev
|
||||
- libfribidi-dev
|
||||
- libgl1-mesa-dev
|
||||
- libjpeg-dev
|
||||
@ -46,7 +47,7 @@ before_script:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew bundle; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sudo mkdir -p /usr/local/include/; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sudo ln -s /System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/ /usr/local/include/GL; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE_PREFIX_PATH=/usr/local/opt/freetype/:/usr/local/opt/curl/:/usr/local/opt/libogg/:/usr/local/opt/libogg/:/usr/local/opt/libvorbis/:/usr/local/opt/openssl\@1.1/:/usr/local/opt/glew/:/usr/local/opt/fribidi/; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE_PREFIX_PATH=/usr/local/opt/freetype/:/usr/local/opt/curl/:/usr/local/opt/libogg/:/usr/local/opt/libogg/:/usr/local/opt/libvorbis/:/usr/local/opt/openssl\@1.1/:/usr/local/opt/glew/:/usr/local/opt/fribidi/:/usr/local/opt/harfbuzz/; fi
|
||||
|
||||
script:
|
||||
- mkdir "build"
|
||||
|
1
Brewfile
1
Brewfile
@ -7,3 +7,4 @@ brew "curl"
|
||||
brew "nettle"
|
||||
brew "fribidi"
|
||||
brew "glew"
|
||||
brew "harfbuzz"
|
||||
|
@ -29,8 +29,6 @@ option(USE_SQLITE3 "Use sqlite to manage server stats and ban list." ON)
|
||||
option(USE_CRYPTO_OPENSSL "Use OpenSSL instead of Nettle for cryptography in STK." OFF)
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_RECORDER "Build opengl recorder" ON
|
||||
"NOT SERVER_ONLY;NOT APPLE" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(USE_FRIBIDI "Support for right-to-left languages" ON
|
||||
"NOT SERVER_ONLY" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(USE_SYSTEM_SQUISH "Use system Squish library instead of the built-in version, when available." ON
|
||||
"NOT SERVER_ONLY" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(USE_WIIUSE "Support for wiimote input devices" ON
|
||||
@ -42,6 +40,7 @@ if(APPLE)
|
||||
include_directories(/usr/local/opt/openssl@1.1/include/)
|
||||
include_directories(/usr/local/opt/openssl@1.1/include/openssl/)
|
||||
include_directories(/usr/local/opt/freetype/include/freetype2/)
|
||||
include_directories(/usr/local/opt/harfbuzz/include/harfbuzz/)
|
||||
endif()
|
||||
|
||||
if((UNIX AND NOT APPLE) AND NOT SERVER_ONLY)
|
||||
@ -187,17 +186,8 @@ elseif(NOT USE_GLES2 AND NOT SERVER_ONLY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# Build zlib library
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/zlib")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/zlib")
|
||||
|
||||
set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lib/zlib" "${PROJECT_BINARY_DIR}/lib/zlib/")
|
||||
set(ZLIB_LIBRARY zlibstatic)
|
||||
endif()
|
||||
|
||||
if (NOT SERVER_ONLY)
|
||||
if(MSVC OR APPLE)
|
||||
if (APPLE)
|
||||
# Build png library
|
||||
set(SKIP_INSTALL_ALL TRUE)
|
||||
set(PNG_STATIC TRUE CACHE BOOL "Build static lib")
|
||||
@ -328,27 +318,50 @@ if(NOT SERVER_ONLY)
|
||||
add_definitions(-DENABLE_SOUND)
|
||||
endif()
|
||||
|
||||
# Freetype
|
||||
# Text handling in STK (We use freetype, harfbuzz, fribidi and libraqm for i18n text handling)
|
||||
if (NOT SERVER_ONLY)
|
||||
# Freetype
|
||||
find_package(Freetype)
|
||||
if(FREETYPE_FOUND)
|
||||
include_directories(${FREETYPE_INCLUDE_DIRS})
|
||||
else()
|
||||
message(FATAL_ERROR "Freetype not found. "
|
||||
"Freetype is required to display characters in SuperTuxKart. ")
|
||||
"Freetype is required to display characters in SuperTuxKart.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Fribidi
|
||||
if(USE_FRIBIDI)
|
||||
# Harfbuzz
|
||||
find_library(HARFBUZZ_LIBRARY NAMES harfbuzz libharfbuzz)
|
||||
find_path(HARFBUZZ_INCLUDEDIR NAMES harfbuzz/hb.h hb.h PATHS)
|
||||
if (NOT HARFBUZZ_LIBRARY OR NOT HARFBUZZ_INCLUDEDIR)
|
||||
message(FATAL_ERROR "Harfbuzz not found. "
|
||||
"Harfbuzz is required to display characters in SuperTuxKart.")
|
||||
else()
|
||||
include_directories("${HARFBUZZ_INCLUDEDIR}")
|
||||
MESSAGE(STATUS "Use system harfbuzz: ${HARFBUZZ_LIBRARY}")
|
||||
endif()
|
||||
|
||||
# Fribidi
|
||||
find_package(Fribidi)
|
||||
if(FRIBIDI_FOUND)
|
||||
include_directories(${FRIBIDI_INCLUDE_DIRS})
|
||||
else()
|
||||
message(FATAL_ERROR "Fribidi not found. "
|
||||
"Either install fribidi or disable bidi support with -DUSE_FRIBIDI=0 "
|
||||
"(if you don't use a right-to-left language then you don't need this).")
|
||||
"Fribidi is required to display characters in SuperTuxKart.")
|
||||
endif()
|
||||
|
||||
# Libraqm
|
||||
find_library(RAQM_LIBRARY NAMES raqm libraqm)
|
||||
find_path(RAQM_INCLUDEDIR NAMES raqm.h PATHS)
|
||||
if (NOT RAQM_LIBRARY OR NOT RAQM_INCLUDEDIR)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/libraqm")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/libraqm")
|
||||
SET(RAQM_LIBRARY raqm)
|
||||
message(STATUS "System libraqm not found, use the bundled one.")
|
||||
else()
|
||||
include_directories("${RAQM_INCLUDEDIR}")
|
||||
MESSAGE(STATUS "Use system libraqm: ${RAQM_LIBRARY}")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# OpenGL
|
||||
@ -559,10 +572,13 @@ if(NOT SERVER_ONLY)
|
||||
|
||||
target_link_libraries(supertuxkart
|
||||
${SQUISH_LIBRARY}
|
||||
${FREETYPE_LIBRARIES}
|
||||
${JPEG_LIBRARIES}
|
||||
${OGGVORBIS_LIBRARIES}
|
||||
${OPENAL_LIBRARY}
|
||||
${RAQM_LIBRARY}
|
||||
${FRIBIDI_LIBRARIES}
|
||||
${FREETYPE_LIBRARIES}
|
||||
${HARFBUZZ_LIBRARY}
|
||||
graphics_utils)
|
||||
endif()
|
||||
|
||||
@ -585,11 +601,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
|
||||
endif()
|
||||
|
||||
if(USE_FRIBIDI)
|
||||
target_link_libraries(supertuxkart ${FRIBIDI_LIBRARIES})
|
||||
add_definitions(-DENABLE_BIDI)
|
||||
endif()
|
||||
|
||||
# Wiiuse
|
||||
# ------
|
||||
if(USE_WIIUSE)
|
||||
|
10
INSTALL.md
10
INSTALL.md
@ -18,6 +18,8 @@ To build SuperTuxKart from source, you'll need to install the following packages
|
||||
* Ogg (libogg-dev)
|
||||
* Vorbis (libvorbis-dev)
|
||||
* Freetype (libfreetype6-dev)
|
||||
* Harfbuzz (libharfbuzz-dev)
|
||||
* Fribidi (libfribidi-dev)
|
||||
* libcurl (libcurl-devel)
|
||||
* libbluetooth (bluez-devel)
|
||||
* libnettle (nettle-dev)
|
||||
@ -29,14 +31,14 @@ Fedora command:
|
||||
|
||||
```bash
|
||||
sudo dnf install @development-tools cmake bluez-libs-devel \
|
||||
openssl-devel libcurl-devel freetype-devel fribidi-devel mesa-libGL-devel \
|
||||
openssl-devel libcurl-devel freetype-devel harfbuzz-devel fribidi-devel mesa-libGL-devel \
|
||||
libjpeg-turbo-devel libogg-devel openal-soft-devel libpng-devel \
|
||||
libvorbis-devel libXrandr-devel libGLEW nettle-devel pkgconf zlib-devel
|
||||
```
|
||||
Mageia 6 command:
|
||||
|
||||
```bash
|
||||
su -c 'urpmi gcc-c++ cmake openssl-devel libcurl-devel freetype-devel \
|
||||
su -c 'urpmi gcc-c++ cmake openssl-devel libcurl-devel freetype-devel harfbuzz-devel \
|
||||
fribidi-devel libjpeg-turbo-devel libogg-devel openal-soft-devel \
|
||||
libpng-devel libvorbis-devel nettle-devel zlib-devel git subversion \
|
||||
mesa-comon-devel libxrandr-devel libbluez-devel libfreetype6-devel'
|
||||
@ -45,7 +47,7 @@ OpenSUSE command:
|
||||
|
||||
```bash
|
||||
sudo zypper install gcc-c++ cmake openssl-devel libcurl-devel \
|
||||
freetype-devel fribidi-devel libogg-devel openal-soft-devel libpng-devel \
|
||||
freetype-devel harfbuzz-devel fribidi-devel libogg-devel openal-soft-devel libpng-devel \
|
||||
libvorbis-devel libXrandr-devel pkgconf zlib-devel enet-devel glew-devel \
|
||||
libjpeg-devel bluez-devel freetype2-devel glu-devel
|
||||
```
|
||||
@ -53,7 +55,7 @@ Ubuntu command:
|
||||
|
||||
```bash
|
||||
sudo apt-get install build-essential cmake libbluetooth-dev \
|
||||
libcurl4-openssl-dev libenet-dev libfreetype6-dev libfribidi-dev \
|
||||
libcurl4-openssl-dev libenet-dev libfreetype6-dev libharfbuzz-dev libfribidi-dev \
|
||||
libgl1-mesa-dev libglew-dev libjpeg-dev libogg-dev libopenal-dev libpng-dev \
|
||||
libssl-dev libvorbis-dev libxrandr-dev libx11-dev nettle-dev pkg-config zlib1g-dev
|
||||
```
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
if(WIN32)
|
||||
find_path(FREETYPE_INCLUDE_DIRS NAMES freetype/freetype.h PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include")
|
||||
find_library(FREETYPE_LIBRARY NAMES freetype PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
|
||||
find_library(FREETYPE_LIBRARY NAMES freetype libfreetype PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
|
||||
set(FREETYPE_FOUND 1)
|
||||
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
|
||||
elseif(APPLE)
|
||||
|
@ -18,7 +18,7 @@ endif()
|
||||
|
||||
if(NOT FRIBIDI_FOUND)
|
||||
find_path(FRIBIDI_INCLUDE_DIR NAMES fribidi/fribidi.h PATHS /Library/Frameworks/fribidi.framework/Headers "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include")
|
||||
find_library(FRIBIDI_LIBRARY NAMES fribidi PATHS /Library/Frameworks/fribidi.framework "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
|
||||
find_library(FRIBIDI_LIBRARY NAMES fribidi libfribidi PATHS /Library/Frameworks/fribidi.framework "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Fribidi DEFAULT_MSG FRIBIDI_INCLUDE_DIR FRIBIDI_LIBRARY)
|
||||
|
@ -2,7 +2,7 @@
|
||||
if(NOT SERVER_ONLY)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(JPEG REQUIRED)
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
||||
"${JPEG_INCLUDE_DIR}"
|
||||
"${PNG_INCLUDE_DIRS}"
|
||||
@ -62,12 +62,8 @@ if(NOT SERVER_ONLY)
|
||||
endif()
|
||||
else()
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/")
|
||||
if(MSVC)
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../zlib/")
|
||||
else()
|
||||
find_package(ZLIB REQUIRED)
|
||||
include_directories("${ZLIB_INCLUDE_DIR}")
|
||||
endif()
|
||||
find_package(ZLIB REQUIRED)
|
||||
include_directories("${ZLIB_INCLUDE_DIR}")
|
||||
add_definitions(-DNO_IRR_COMPILE_WITH_LIBPNG_)
|
||||
add_definitions(-DNO_IRR_COMPILE_WITH_LIBJPEG_)
|
||||
add_definitions(-DNO_IRR_COMPILE_WITH_BMP_LOADER_)
|
||||
|
43
lib/libraqm/CMakeLists.txt
Normal file
43
lib/libraqm/CMakeLists.txt
Normal file
@ -0,0 +1,43 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
if (NOT MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
|
||||
endif()
|
||||
|
||||
include(CheckFunctionExists)
|
||||
include(CheckCSourceCompiles)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${HARFBUZZ_INCLUDEDIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${HARFBUZZ_LIBRARY})
|
||||
|
||||
CHECK_FUNCTION_EXISTS(hb_ft_font_create_referenced HAVE_hb_ft_font_create_referenced)
|
||||
if (HAVE_hb_ft_font_create_referenced)
|
||||
add_definitions(-DHAVE_HB_FT_FONT_CREATE_REFERENCED)
|
||||
endif()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(hb_ft_font_set_load_flags HAVE_hb_ft_font_set_load_flags)
|
||||
if (HAVE_hb_ft_font_set_load_flags)
|
||||
add_definitions(-DHAVE_HB_FT_FONT_SET_LOAD_FLAGS)
|
||||
endif()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(hb_buffer_set_invisible_glyph HAVE_hb_buffer_set_invisible_glyph)
|
||||
if (HAVE_hb_buffer_set_invisible_glyph)
|
||||
add_definitions(-DHAVE_HB_BUFFER_SET_INVISIBLE_GLYPH)
|
||||
endif()
|
||||
|
||||
CHECK_C_SOURCE_COMPILES(
|
||||
"
|
||||
#include <harfbuzz/hb.h>
|
||||
int main ()
|
||||
{
|
||||
#ifndef HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES
|
||||
(void)HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
HAVE_DECL_HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES)
|
||||
if (HAVE_DECL_HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES)
|
||||
add_definitions(-DHAVE_DECL_HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES)
|
||||
endif()
|
||||
|
||||
add_library(raqm STATIC raqm.c)
|
44
lib/libraqm/raqm-version.h
Normal file
44
lib/libraqm/raqm-version.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright © 2011 Google, Inc.
|
||||
*
|
||||
* This is part of HarfBuzz, a text shaping library.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#ifndef _RAQM_H_IN_
|
||||
#error "Include <raqm.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef _RAQM_VERSION_H_
|
||||
#define _RAQM_VERSION_H_
|
||||
|
||||
#define RAQM_VERSION_MAJOR 0
|
||||
#define RAQM_VERSION_MINOR 7
|
||||
#define RAQM_VERSION_MICRO 0
|
||||
|
||||
#define RAQM_VERSION_STRING "0.7.0"
|
||||
|
||||
#define RAQM_VERSION_ATLEAST(major,minor,micro) \
|
||||
((major)*10000+(minor)*100+(micro) <= \
|
||||
RAQM_VERSION_MAJOR*10000+RAQM_VERSION_MINOR*100+RAQM_VERSION_MICRO)
|
||||
|
||||
#endif /* _RAQM_VERSION_H_ */
|
44
lib/libraqm/raqm-version.h.in
Normal file
44
lib/libraqm/raqm-version.h.in
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright © 2011 Google, Inc.
|
||||
*
|
||||
* This is part of HarfBuzz, a text shaping library.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#ifndef _RAQM_H_IN_
|
||||
#error "Include <raqm.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef _RAQM_VERSION_H_
|
||||
#define _RAQM_VERSION_H_
|
||||
|
||||
#define RAQM_VERSION_MAJOR @RAQM_VERSION_MAJOR@
|
||||
#define RAQM_VERSION_MINOR @RAQM_VERSION_MINOR@
|
||||
#define RAQM_VERSION_MICRO @RAQM_VERSION_MICRO@
|
||||
|
||||
#define RAQM_VERSION_STRING "@RAQM_VERSION@"
|
||||
|
||||
#define RAQM_VERSION_ATLEAST(major,minor,micro) \
|
||||
((major)*10000+(minor)*100+(micro) <= \
|
||||
RAQM_VERSION_MAJOR*10000+RAQM_VERSION_MINOR*100+RAQM_VERSION_MICRO)
|
||||
|
||||
#endif /* _RAQM_VERSION_H_ */
|
2080
lib/libraqm/raqm.c
Normal file
2080
lib/libraqm/raqm.c
Normal file
File diff suppressed because it is too large
Load Diff
185
lib/libraqm/raqm.h
Normal file
185
lib/libraqm/raqm.h
Normal file
@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright © 2015 Information Technology Authority (ITA) <foss@ita.gov.om>
|
||||
* Copyright © 2016 Khaled Hosny <khaledhosny@eglug.org>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RAQM_H_
|
||||
#define _RAQM_H_
|
||||
#define _RAQM_H_IN_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "raqm-version.h"
|
||||
|
||||
/**
|
||||
* raqm_t:
|
||||
*
|
||||
* This is the main object holding all state of the currently processed text as
|
||||
* well as its output.
|
||||
*
|
||||
* Since: 0.1
|
||||
*/
|
||||
typedef struct _raqm raqm_t;
|
||||
|
||||
/**
|
||||
* raqm_direction_t:
|
||||
* @RAQM_DIRECTION_DEFAULT: Detect paragraph direction automatically.
|
||||
* @RAQM_DIRECTION_RTL: Paragraph is mainly right-to-left text.
|
||||
* @RAQM_DIRECTION_LTR: Paragraph is mainly left-to-right text.
|
||||
* @RAQM_DIRECTION_TTB: Paragraph is mainly vertical top-to-bottom text.
|
||||
*
|
||||
* Base paragraph direction, see raqm_set_par_direction().
|
||||
*
|
||||
* Since: 0.1
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
RAQM_DIRECTION_DEFAULT,
|
||||
RAQM_DIRECTION_RTL,
|
||||
RAQM_DIRECTION_LTR,
|
||||
RAQM_DIRECTION_TTB
|
||||
} raqm_direction_t;
|
||||
|
||||
/**
|
||||
* raqm_glyph_t:
|
||||
* @index: the index of the glyph in the font file.
|
||||
* @x_advance: the glyph advance width in horizontal text.
|
||||
* @y_advance: the glyph advance width in vertical text.
|
||||
* @x_offset: the horizontal movement of the glyph from the current point.
|
||||
* @y_offset: the vertical movement of the glyph from the current point.
|
||||
* @cluster: the index of original character in input text.
|
||||
* @ftface: the @FT_Face of the glyph.
|
||||
*
|
||||
* The structure that holds information about output glyphs, returned from
|
||||
* raqm_get_glyphs().
|
||||
*/
|
||||
typedef struct raqm_glyph_t {
|
||||
unsigned int index;
|
||||
int x_advance;
|
||||
int y_advance;
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
uint32_t cluster;
|
||||
FT_Face ftface;
|
||||
} raqm_glyph_t;
|
||||
|
||||
raqm_t *
|
||||
raqm_create (void);
|
||||
|
||||
raqm_t *
|
||||
raqm_reference (raqm_t *rq);
|
||||
|
||||
void
|
||||
raqm_destroy (raqm_t *rq);
|
||||
|
||||
bool
|
||||
raqm_set_text (raqm_t *rq,
|
||||
const uint32_t *text,
|
||||
size_t len);
|
||||
|
||||
bool
|
||||
raqm_set_text_utf8 (raqm_t *rq,
|
||||
const char *text,
|
||||
size_t len);
|
||||
|
||||
bool
|
||||
raqm_set_par_direction (raqm_t *rq,
|
||||
raqm_direction_t dir);
|
||||
|
||||
bool
|
||||
raqm_set_language (raqm_t *rq,
|
||||
const char *lang,
|
||||
size_t start,
|
||||
size_t len);
|
||||
|
||||
bool
|
||||
raqm_add_font_feature (raqm_t *rq,
|
||||
const char *feature,
|
||||
int len);
|
||||
|
||||
bool
|
||||
raqm_set_freetype_face (raqm_t *rq,
|
||||
FT_Face face);
|
||||
|
||||
bool
|
||||
raqm_set_freetype_face_range (raqm_t *rq,
|
||||
FT_Face face,
|
||||
size_t start,
|
||||
size_t len);
|
||||
|
||||
bool
|
||||
raqm_set_freetype_load_flags (raqm_t *rq,
|
||||
int flags);
|
||||
|
||||
bool
|
||||
raqm_set_invisible_glyph (raqm_t *rq,
|
||||
int gid);
|
||||
|
||||
bool
|
||||
raqm_layout (raqm_t *rq);
|
||||
|
||||
raqm_glyph_t *
|
||||
raqm_get_glyphs (raqm_t *rq,
|
||||
size_t *length);
|
||||
|
||||
bool
|
||||
raqm_index_to_position (raqm_t *rq,
|
||||
size_t *index,
|
||||
int *x,
|
||||
int *y);
|
||||
|
||||
bool
|
||||
raqm_position_to_index (raqm_t *rq,
|
||||
int x,
|
||||
int y,
|
||||
size_t *index);
|
||||
|
||||
void
|
||||
raqm_version (unsigned int *major,
|
||||
unsigned int *minor,
|
||||
unsigned int *micro);
|
||||
|
||||
const char *
|
||||
raqm_version_string (void);
|
||||
|
||||
bool
|
||||
raqm_version_atleast (unsigned int major,
|
||||
unsigned int minor,
|
||||
unsigned int micro);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#undef _RAQM_H_IN_
|
||||
#endif /* _RAQM_H_ */
|
Loading…
Reference in New Issue
Block a user