Commit 9d9be714 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

add compile-time configuration options for the text backend

parent b323f287
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ cmake_install.cmake
*.dll
*.dylib
/fviz
/fviz_config.h
/.ninja_deps
/.ninja_log
/*.ninja
+26 −17
Original line number Diff line number Diff line
project(fviz)
add_definitions("-Dfviz_VERSION='\"v0.4.0\"'")
cmake_minimum_required(VERSION 3.6)
project(fviz VERSION "0.4.0")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/platform/cmake")
enable_testing()


# CMake Setup
# Options
# -----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.8)
enable_testing()
option(FVIZ_TEXT_ENABLE_BIDI "Enable bi-directional text support" ON)
set(FVIZ_TEXT_BACKEND "linux" CACHE STRING "Set the text backend")
option(FVIZ_TESTING "Builds with testing flags [default: OFF]" OFF)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/platform/cmake")

# Dependencies
# -----------------------------------------------------------------------------
find_package(Threads)
find_package(Cairo)
find_package(Freetype)
find_package(HarfBuzz)
find_package(Fontconfig)
find_package(PNG)
include_directories(${CAIRO_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS} ${HARFBUZZ_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS}})


# Compile Flags
# -----------------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")

@@ -15,9 +31,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/core)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/core/utils)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

option(FVIZ_TESTING "Builds with testing flags [default: OFF]" OFF)
option(FVIZ_TESTING "Builds with coverage flags [default: OFF]" OFF)

if(FVIZ_TESTING)
  add_compile_options(
      -Wall
@@ -41,15 +54,11 @@ if(FVIZ_TESTING)
endif()


# Dependencies
# Build: Config
# -----------------------------------------------------------------------------
find_package(Threads)
find_package(Cairo)
find_package(Freetype)
find_package(HarfBuzz)
find_package(Fontconfig)
find_package(PNG)
include_directories(${CAIRO_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS} ${HARFBUZZ_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS}})
configure_file(core/config.h.in fviz_config.h)
message(STATUS "Config Options: text_backend=${FVIZ_TEXT_BACKEND}")
message(STATUS "Config Options: text_enable_bidi=${FVIZ_TEXT_ENABLE_BIDI}")


# Build: fviz Library
+2 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <unistd.h>
#include <iostream>
#include "fviz.h"
#include "fviz_config.h"
#include "utils/flagparser.h"
#include "return_code.h"
#include "utils/stringutil.h"
@@ -61,7 +62,7 @@ int main(int argc, const char** argv) {
            "Part of the fviz project (https://fviz.org)\n"
            "Copyright (c) 2019, Paul Asmuth, Laura Schlimmer.\n"
            "All rights reserved.\n\n",
            fviz_VERSION);
            FVIZ_VERSION);

    return 0;
  }

core/config.h.in

0 → 100644
+3 −0
Original line number Diff line number Diff line
#cmakedefine01 FVIZ_TEXT_ENABLE_BIDI
#define FVIZ_TEXT_BACKEND "${FVIZ_TEXT_BACKEND}"
#define FVIZ_VERSION "${PROJECT_VERSION}"
+2 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ Status drawTextLabel(
    const TextStyle& style,
    Layer* layer) {
  text::TextSpan span;
  span.text_direction = style.direction;
  span.text = text;
  span.font = style.font;
  span.font_size = style.font_size;
@@ -109,6 +110,7 @@ Status text_measure_label(
    Rectangle* bbox) {
  text::TextSpan span;
  span.text = text;
  span.text_direction = text_direction_base;
  span.font = font;
  span.font_size = font_size;
  span.span_id = 0;
Loading