Skip to content

Commit

Permalink
Merge latest code changes into the debian branch
Browse files Browse the repository at this point in the history
  • Loading branch information
inniyah committed Jul 7, 2021
2 parents 284a46e + 57ebea9 commit 49cb81a
Show file tree
Hide file tree
Showing 10 changed files with 4,315 additions and 4,187 deletions.
20 changes: 18 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ option(NANOVG_BUILD_GL2 "Build OpenGL 2" ON)
option(NANOVG_BUILD_GL3 "Build OpenGL 3" ON)
option(NANOVG_BUILD_GLES2 "Build OpenGL ES 2" ON)
option(NANOVG_BUILD_GLES3 "Build OpenGL ES 3" ON)
option(NANOVG_BUILD_SVG "Build NanoSVG" ON)
option(NANOVG_BUILD_OUI "Build OUI/Blendish" ON)

SET(NANOVG_DEFINES "")
SET(NANOVG_SOURCES "src/nanovg.c" "src/android.c")
SET(NANOVG_GL_DEFINES "")
SET(NANOVG_GL_SOURCES "src/nanovg_gl.c" "src/nanovg_gl_utils.c")
SET(NANOVG_GLES_SOURCES "src/nanovg_gl.c" "src/nanovg_gl_utils.c")
SET(NANOSVG_DEFINES "")
SET(NANOSVG_SOURCES "src/nanosvg.c" "src/nanosvgrast.c")
SET(NANOVG_OUI_DEFINES "")
SET(NANOVG_OUI_SOURCES "src/oui.c" "src/blendish.c")

Expand Down Expand Up @@ -64,6 +67,13 @@ IF(NANOVG_BUILD_GLES3)
SET_PROPERTY(TARGET nanovg_gles3 PROPERTY POSITION_INDEPENDENT_CODE ON)
ENDIF()

IF(NANOVG_BUILD_SVG)
ADD_LIBRARY(nanosvg OBJECT ${NANOSVG_SOURCES})
TARGET_INCLUDE_DIRECTORIES(nanosvg PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
TARGET_COMPILE_DEFINITIONS(nanosvg PRIVATE ${NANOSVG_DEFINES})
SET_PROPERTY(TARGET nanosvg PROPERTY POSITION_INDEPENDENT_CODE ON)
ENDIF()

IF(NANOVG_BUILD_OUI)
ADD_LIBRARY(nanovg_oui OBJECT ${NANOVG_OUI_SOURCES})
TARGET_INCLUDE_DIRECTORIES(nanovg_oui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
Expand All @@ -89,6 +99,10 @@ IF(NANOVG_BUILD_GLES3)
SET(NANOVG_LIB_NAMES ${NANOVG_LIB_NAMES} nanovg_gles3)
SET(NANOVG_LIB_OBJECTS ${NANOVG_LIB_OBJECTS} $<TARGET_OBJECTS:nanovg_gles3>)
ENDIF()
IF(NANOVG_BUILD_SVG)
SET(NANOVG_LIB_NAMES ${NANOVG_LIB_NAMES} nanosvg)
SET(NANOVG_LIB_OBJECTS ${NANOVG_LIB_OBJECTS} $<TARGET_OBJECTS:nanosvg>)
ENDIF()
IF(NANOVG_BUILD_OUI)
SET(NANOVG_LIB_NAMES ${NANOVG_LIB_NAMES} nanovg_oui)
SET(NANOVG_LIB_OBJECTS ${NANOVG_LIB_OBJECTS} $<TARGET_OBJECTS:nanovg_oui>)
Expand Down Expand Up @@ -196,11 +210,13 @@ IF(NANOVG_BUILD_GLES3)
TARGET_COMPILE_DEFINITIONS(example_gles3 PRIVATE NANOVG_GLES3)
ENDIF()

ADD_EXECUTABLE(example_svg1 example/example_svg1.c $<TARGET_OBJECTS:nanovg>)
IF(NANOVG_BUILD_SVG)
ADD_EXECUTABLE(example_svg1 example/example_svg1.c $<TARGET_OBJECTS:nanovg> $<TARGET_OBJECTS:nanosvg>)
TARGET_LINK_LIBRARIES(example_svg1 PRIVATE GLEW EGL GL glfw m)

ADD_EXECUTABLE(example_svg2 example/example_svg2.c $<TARGET_OBJECTS:nanovg>)
ADD_EXECUTABLE(example_svg2 example/example_svg2.c $<TARGET_OBJECTS:nanovg> $<TARGET_OBJECTS:nanosvg>)
TARGET_LINK_LIBRARIES(example_svg2 PRIVATE GLEW EGL GL glfw m)
ENDIF()

IF(NANOVG_BUILD_GL3 AND NANOVG_BUILD_OUI)
ADD_EXECUTABLE(example_oui
Expand Down
3 changes: 2 additions & 1 deletion example/example_svg1.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
#include <float.h>
#include <GLFW/glfw3.h>

#define NANOSVG_IMPLEMENTATION
#include "nanosvg.h"

#define NSVG_NOTUSED(v) do { (void)(1 ? (void)0 : ( (void)(v) ) ); } while(0)

NSVGimage* g_image = NULL;

static unsigned char bgColor[4] = {205,202,200,255};
Expand Down
3 changes: 0 additions & 3 deletions example/example_svg2.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <stb/stb_image_write.h>

#define NANOSVG_IMPLEMENTATION
#include "nanosvg.h"

#define NANOSVGRAST_IMPLEMENTATION
#include "nanosvgrast.h"

int main()
Expand Down
2 changes: 1 addition & 1 deletion src/fontstash.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ int fons__tt_buildGlyphBitmap(FONSttFontImpl *font, int glyph, float size, float

ftError = FT_Set_Pixel_Sizes(font->font, 0, size);
if (ftError) return 0;
ftError = FT_Load_Glyph(font->font, glyph, FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT);
ftError = FT_Load_Glyph(font->font, glyph, FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_LIGHT);
if (ftError) return 0;
ftError = FT_Get_Advance(font->font, glyph, FT_LOAD_NO_SCALE, &advFixed);
if (ftError) return 0;
Expand Down
Loading

0 comments on commit 49cb81a

Please sign in to comment.