Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ macro(CREATE_DEMO _target _sources)
add_executable(${_target} ${_sources} $<TARGET_OBJECTS:demo-utils>)
if(${_target} MATCHES "^harfbuzz")
target_link_libraries(${_target}
freetype-gl
freetype-gl-hb
${HARFBUZZ_LIBRARIES}
)
Expand Down Expand Up @@ -101,7 +102,7 @@ endif()
if(ANT_TWEAK_BAR_FOUND)
include_directories(${ANT_TWEAK_BAR_INCLUDE_PATH})
create_demo(atb-agg atb-agg.c)
target_link_libraries(atb-agg ${ANT_TWEAK_BAR_LIBRARY})
target_link_libraries(atb-agg ${ANT_TWEAK_BAR_LIBRARY} -lX11)
set_target_properties(atb-agg PROPERTIES LINKER_LANGUAGE CXX)
endif()

Expand Down
4 changes: 1 addition & 3 deletions harfbuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Distributed under the OSI-approved BSD 2-Clause License. See accompanying
# file `LICENSE` for more details.

find_package(HarfBuzz REQUIRED)
find_package(harfbuzz REQUIRED)

include_directories(
${HARFBUZZ_INCLUDE_DIRS}
Expand All @@ -18,7 +18,6 @@ set(FREETYPE_GL_HB_HDR
vector.h
vertex-attribute.h
vertex-buffer.h
freetype-gl-err.h
freetype-gl-errdef.h
)

Expand All @@ -29,7 +28,6 @@ set(FREETYPE_GL_HB_SRC
vector.c
vertex-attribute.c
vertex-buffer.c
freetype-gl-err.c
)

if(freetype-gl_BUILD_SHARED)
Expand Down
1 change: 0 additions & 1 deletion harfbuzz/freetype-gl-err.c

This file was deleted.

1 change: 0 additions & 1 deletion harfbuzz/freetype-gl-err.h

This file was deleted.

41 changes: 14 additions & 27 deletions harfbuzz/texture-font.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <assert.h>
#include "texture-font.h"
#include "platform.h"
#include "freetype-gl-err.h"
#include "ftgl-utils.h"

#define DPI 72

Expand Down Expand Up @@ -44,8 +44,7 @@ texture_font_load_face(texture_font_t *self, float size,
/* Initialize library */
error = FT_Init_FreeType(library);
if(error) {
freetype_error( error, "FT_Error (line %d, code 0x%02x) : %s\n",
__LINE__, FT_Errors[error].code, FT_Errors[error].message);
freetype_error(error);
return 0;
}

Expand All @@ -62,25 +61,22 @@ texture_font_load_face(texture_font_t *self, float size,
}

if(error) {
freetype_error( error, "FT_Error (line %d, code 0x%02x) : %s\n",
__LINE__, FT_Errors[error].code, FT_Errors[error].message);
freetype_error(error);
FT_Done_FreeType(*library);
return 0;
}

/* Select charmap */
error = FT_Select_Charmap(self->ft_face, FT_ENCODING_UNICODE);
if(error) {
freetype_error( error, "FT_Error (line %d, code 0x%02x) : %s\n",
__LINE__, FT_Errors[error].code, FT_Errors[error].message);
freetype_error(error);
}

/* Set char size */
error = FT_Set_Char_Size(self->ft_face, 0, (int)(self->size*64), DPI * self->hres, DPI);

if(error) {
freetype_error( error, "FT_Error (line %d, code 0x%02x) : %s\n",
__LINE__, FT_Errors[error].code, FT_Errors[error].message);
freetype_error(error);
FT_Done_Face(self->ft_face);
FT_Done_FreeType(*library);
return 0;
Expand Down Expand Up @@ -178,8 +174,7 @@ texture_font_new_from_file(texture_atlas_t *atlas, const float pt_size,

self = calloc(1, sizeof(*self));
if (!self) {
freetype_gl_error( Out_Of_Memory,
"line %d: No more memory for allocating data\n", __LINE__);
freetype_gl_error( Out_Of_Memory );
return NULL;
}

Expand Down Expand Up @@ -209,8 +204,7 @@ texture_font_new_from_memory(texture_atlas_t *atlas, float pt_size,

self = calloc(1, sizeof(*self));
if (!self) {
freetype_gl_error( Out_Of_Memory,
"line %d: No more memory for allocating data\n", __LINE__);
freetype_gl_error( Out_Of_Memory );
return NULL;
}

Expand Down Expand Up @@ -394,8 +388,7 @@ texture_font_load_glyphs( texture_font_t * self,
error = FT_Load_Glyph( self->ft_face, glyph_info[i].codepoint, flags );
if( error )
{
freetype_error( error, "FT_Error (line %d, code 0x%02x) : %s\n",
__LINE__, FT_Errors[error].code, FT_Errors[error].message);
freetype_error( error );
FT_Done_FreeType( library );
return glyph_count - i;
}
Expand All @@ -415,8 +408,7 @@ texture_font_load_glyphs( texture_font_t * self,
error = FT_Stroker_New( library, &stroker );
if( error )
{
freetype_error( error, "FT_Error (line %d, code 0x%02x) : %s\n",
__LINE__, FT_Errors[error].code, FT_Errors[error].message);
freetype_error( error );
FT_Stroker_Done( stroker );
FT_Done_FreeType( library );
return 0;
Expand All @@ -429,8 +421,7 @@ texture_font_load_glyphs( texture_font_t * self,
error = FT_Get_Glyph( self->ft_face->glyph, &ft_glyph);
if( error )
{
freetype_error( error, "FT_Error (line %d, code 0x%02x) : %s\n",
__LINE__, FT_Errors[error].code, FT_Errors[error].message);
freetype_error( error );
FT_Stroker_Done( stroker );
FT_Done_FreeType( library );
return 0;
Expand All @@ -445,8 +436,7 @@ texture_font_load_glyphs( texture_font_t * self,

if( error )
{
freetype_error( error, "FT_Error (line %d, code 0x%02x) : %s\n",
__LINE__, FT_Errors[error].code, FT_Errors[error].message);
freetype_error( error );
FT_Stroker_Done( stroker );
FT_Done_FreeType( library );
return 0;
Expand All @@ -457,8 +447,7 @@ texture_font_load_glyphs( texture_font_t * self,
error = FT_Glyph_To_Bitmap( &ft_glyph, FT_RENDER_MODE_NORMAL, 0, 1);
if( error )
{
freetype_error( error, "FT_Error (line %d, code 0x%02x) : %s\n",
__LINE__, FT_Errors[error].code, FT_Errors[error].message);
freetype_error( error );
FT_Stroker_Done( stroker );
FT_Done_FreeType( library );
return 0;
Expand All @@ -469,8 +458,7 @@ texture_font_load_glyphs( texture_font_t * self,
error = FT_Glyph_To_Bitmap( &ft_glyph, FT_RENDER_MODE_LCD, 0, 1);
if( error )
{
freetype_error( error, "FT_Error (line %d, code 0x%02x) : %s\n",
__LINE__, FT_Errors[error].code, FT_Errors[error].message);
freetype_error( error );
FT_Stroker_Done( stroker );
FT_Done_FreeType( library );
return 0;
Expand All @@ -491,8 +479,7 @@ texture_font_load_glyphs( texture_font_t * self,
if ( region.x < 0 )
{
missed++;
freetype_gl_error( Texture_Atlas_Full,
"Texture atlas is full (line %d)\n", __LINE__ );
freetype_gl_error( Texture_Atlas_Full );
continue;
}
x = region.x;
Expand Down