Browse Source

Remove references to freetype

gh-pages
falkTX 9 years ago
parent
commit
304054af33
31 changed files with 0 additions and 184197 deletions
  1. +0
    -12
      dgl/Makefile
  2. +0
    -270
      dgl/src/freetype-gl/font-manager.c
  3. +0
    -205
      dgl/src/freetype-gl/font-manager.h
  4. +0
    -241
      dgl/src/freetype-gl/freetype-errors.h
  5. +0
    -44
      dgl/src/freetype-gl/freetype-gl.h
  6. +0
    -191
      dgl/src/freetype-gl/markup.h
  7. +0
    -263
      dgl/src/freetype-gl/mat4.c
  8. +0
    -117
      dgl/src/freetype-gl/mat4.h
  9. +0
    -37
      dgl/src/freetype-gl/opengl.h
  10. +0
    -71
      dgl/src/freetype-gl/platform.h
  11. +0
    -124
      dgl/src/freetype-gl/shader.c
  12. +0
    -119
      dgl/src/freetype-gl/shader.h
  13. +0
    -448
      dgl/src/freetype-gl/text-buffer.c
  14. +0
    -285
      dgl/src/freetype-gl/text-buffer.h
  15. +0
    -345
      dgl/src/freetype-gl/texture-atlas.c
  16. +0
    -225
      dgl/src/freetype-gl/texture-atlas.h
  17. +0
    -713
      dgl/src/freetype-gl/texture-font.c
  18. +0
    -451
      dgl/src/freetype-gl/texture-font.h
  19. +0
    -237
      dgl/src/freetype-gl/vec234.h
  20. +0
    -362
      dgl/src/freetype-gl/vector.c
  21. +0
    -353
      dgl/src/freetype-gl/vector.h
  22. +0
    -168
      dgl/src/freetype-gl/vertex-attribute.c
  23. +0
    -320
      dgl/src/freetype-gl/vertex-attribute.h
  24. +0
    -662
      dgl/src/freetype-gl/vertex-buffer.c
  25. +0
    -350
      dgl/src/freetype-gl/vertex-buffer.h
  26. +0
    -169
      dgl/src/freetype/FTL.TXT
  27. +0
    -166730
      dgl/src/freetype/FreeTypeAmalgam.c
  28. +0
    -10275
      dgl/src/freetype/FreeTypeAmalgam.h
  29. +0
    -340
      dgl/src/freetype/GPLv2.TXT
  30. +0
    -34
      dgl/src/freetype/LICENSE.TXT
  31. +0
    -36
      dgl/src/freetype/README.md

+ 0
- 12
dgl/Makefile View File

@@ -31,18 +31,6 @@ else
OBJS += src/Window.cpp.o
endif

# freetype-gl
# OBJS += \
# src/freetype-gl/font-manager.c.o \
# src/freetype-gl/mat4.c.o \
# src/freetype-gl/shader.c.o \
# src/freetype-gl/text-buffer.c.o \
# src/freetype-gl/texture-atlas.c.o \
# src/freetype-gl/texture-font.c.o \
# src/freetype-gl/vector.c.o \
# src/freetype-gl/vertex-attribute.c.o \
# src/freetype-gl/vertex-buffer.c.o

TARGET = ../libdgl.a

# --------------------------------------------------------------


+ 0
- 270
dgl/src/freetype-gl/font-manager.c View File

@@ -1,270 +0,0 @@
/* ============================================================================
* Freetype GL - A C OpenGL Freetype engine
* Platform: Any
* WWW: http://code.google.com/p/freetype-gl/
* ----------------------------------------------------------------------------
* Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Nicolas P. Rougier.
* ============================================================================
*/
#if 0
# if !defined(_WIN32) && !defined(_WIN64)
# include <fontconfig/fontconfig.h>
# endif
#endif
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include "font-manager.h"
// ------------------------------------------------------------ file_exists ---
int
file_exists( const char * filename )
{
FILE * file = fopen( filename, "r" );
if ( file )
{
fclose(file);
return 1;
}
return 0;
}
// ------------------------------------------------------- font_manager_new ---
font_manager_t *
font_manager_new( size_t width, size_t height, size_t depth )
{
font_manager_t *self;
texture_atlas_t *atlas = texture_atlas_new( width, height, depth );
self = (font_manager_t *) malloc( sizeof(font_manager_t) );
if( !self )
{
fprintf( stderr,
"line %d: No more memory for allocating data\n", __LINE__ );
exit( EXIT_FAILURE );
}
self->atlas = atlas;
self->fonts = vector_new( sizeof(texture_font_t *) );
self->cache = wcsdup( L" " );
return self;
}
// ---------------------------------------------------- font_manager_delete ---
void
font_manager_delete( font_manager_t * self )
{
size_t i;
texture_font_t *font;
assert( self );
for( i=0; i<vector_size( self->fonts ); ++i)
{
font = *(texture_font_t **) vector_get( self->fonts, i );
texture_font_delete( font );
}
vector_delete( self->fonts );
texture_atlas_delete( self->atlas );
if( self->cache )
{
free( self->cache );
}
free( self );
}
// ----------------------------------------------- font_manager_delete_font ---
void
font_manager_delete_font( font_manager_t * self,
texture_font_t * font)
{
size_t i;
texture_font_t *other;
assert( self );
assert( font );
for( i=0; i<self->fonts->size;++i )
{
other = (texture_font_t *) vector_get( self->fonts, i );
if ( (strcmp(font->filename, other->filename) == 0)
&& ( font->size == other->size) )
{
vector_erase( self->fonts, i);
break;
}
}
texture_font_delete( font );
}
// ----------------------------------------- font_manager_get_from_filename ---
texture_font_t *
font_manager_get_from_filename( font_manager_t *self,
const char * filename,
const float size )
{
size_t i;
texture_font_t *font;
assert( self );
for( i=0; i<vector_size(self->fonts); ++i )
{
font = * (texture_font_t **) vector_get( self->fonts, i );
if( (strcmp(font->filename, filename) == 0) && ( font->size == size) )
{
return font;
}
}
font = texture_font_new_from_file( self->atlas, size, filename );
if( font )
{
vector_push_back( self->fonts, &font );
texture_font_load_glyphs( font, self->cache );
return font;
}
fprintf( stderr, "Unable to load \"%s\" (size=%.1f)\n", filename, size );
return 0;
}
// ----------------------------------------- font_manager_get_from_description ---
texture_font_t *
font_manager_get_from_description( font_manager_t *self,
const char * family,
const float size,
const int bold,
const int italic )
{
texture_font_t *font;
char *filename = 0;
assert( self );
if( file_exists( family ) )
{
filename = strdup( family );
}
else
{
#if defined(_WIN32) || defined(_WIN64)
fprintf( stderr, "\"font_manager_get_from_description\" not implemented yet.\n" );
return 0;
#endif
filename = font_manager_match_description( self, family, size, bold, italic );
if( !filename )
{
fprintf( stderr, "No \"%s (size=%.1f, bold=%d, italic=%d)\" font available.\n",
family, size, bold, italic );
return 0;
}
}
font = font_manager_get_from_filename( self, filename, size );
free( filename );
return font;
}
// ------------------------------------------- font_manager_get_from_markup ---
texture_font_t *
font_manager_get_from_markup( font_manager_t *self,
const markup_t *markup )
{
assert( self );
assert( markup );
return font_manager_get_from_description( self, markup->family, markup->size,
markup->bold, markup->italic );
}
// ----------------------------------------- font_manager_match_description ---
char *
font_manager_match_description( font_manager_t * self,
const char * family,
const float size,
const int bold,
const int italic )
{
// Use of fontconfig is disabled by default.
#if 1
return 0;
#else
# if defined _WIN32 || defined _WIN64
fprintf( stderr, "\"font_manager_match_description\" not implemented for windows.\n" );
return 0;
# endif
char *filename = 0;
int weight = FC_WEIGHT_REGULAR;
int slant = FC_SLANT_ROMAN;
if ( bold )
{
weight = FC_WEIGHT_BOLD;
}
if( italic )
{
slant = FC_SLANT_ITALIC;
}
FcInit();
FcPattern *pattern = FcPatternCreate();
FcPatternAddDouble( pattern, FC_SIZE, size );
FcPatternAddInteger( pattern, FC_WEIGHT, weight );
FcPatternAddInteger( pattern, FC_SLANT, slant );
FcPatternAddString( pattern, FC_FAMILY, (FcChar8*) family );
FcConfigSubstitute( 0, pattern, FcMatchPattern );
FcDefaultSubstitute( pattern );
FcResult result;
FcPattern *match = FcFontMatch( 0, pattern, &result );
FcPatternDestroy( pattern );
if ( !match )
{
fprintf( stderr, "fontconfig error: could not match family '%s'", family );
return 0;
}
else
{
FcValue value;
FcResult result = FcPatternGet( match, FC_FILE, 0, &value );
if ( result )
{
fprintf( stderr, "fontconfig error: could not match family '%s'", family );
}
else
{
filename = strdup( (char *)(value.u.s) );
}
}
FcPatternDestroy( match );
return filename;
#endif
}

+ 0
- 205
dgl/src/freetype-gl/font-manager.h View File

@@ -1,205 +0,0 @@
/* ============================================================================
* Freetype GL - A C OpenGL Freetype engine
* Platform: Any
* WWW: http://code.google.com/p/freetype-gl/
* ----------------------------------------------------------------------------
* Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Nicolas P. Rougier.
* ============================================================================
*/
#ifndef __FONT_MANAGER_H__
#define __FONT_MANAGER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "vector.h"
#include "markup.h"
#include "texture-font.h"
#include "texture-atlas.h"
/**
* @file font-manager.h
* @author Nicolas Rougier (Nicolas.Rougier@inria.fr)
*
* @defgroup font-manager Font manager
*
* Structure in charge of caching fonts.
*
* <b>Example Usage</b>:
* @code
* #include "font-manager.h"
*
* int main( int arrgc, char *argv[] )
* {
* font_manager_t * manager = manager_new( 512, 512, 1 );
* texture_font_t * font = font_manager_get( manager, "Mono", 12, 0, 0 );
*
* return 0;
* }
* @endcode
*
* @{
*/
/**
* Structure in charge of caching fonts.
*/
typedef struct font_manager_t {
/**
* Texture atlas to hold font glyphs.
*/
texture_atlas_t * atlas;
/**
* Cached textures.
*/
vector_t * fonts;
/**
* Default glyphs to be loaded when loading a new font.
*/
wchar_t * cache;
} font_manager_t;
/**
* Creates a new empty font manager.
*
* @param width width of the underlying atlas
* @param height height of the underlying atlas
* @param depth bit depth of the underlying atlas
*
* @return a new font manager.
*
*/
font_manager_t *
font_manager_new( size_t width,
size_t height,
size_t depth );
/**
* Deletes a font manager.
*
* @param self a font manager.
*/
void
font_manager_delete( font_manager_t *self );
/**
* Deletes a font from the font manager.
*
* Note that font glyphs are not removed from the atlas.
*
* @param self a font manager.
* @param font font to be deleted
*
*/
void
font_manager_delete_font( font_manager_t * self,
texture_font_t * font );
/**
* Request for a font based on a filename.
*
* @param self a font manager.
* @param filename font filename
* @param size font size
*
* @return Requested font
*/
texture_font_t *
font_manager_get_from_filename( font_manager_t * self,
const char * filename,
const float size );
/**
* Request for a font based on a description
*
* @param self a font manager
* @param family font family
* @param size font size
* @param bold whether font is bold
* @param italic whether font is italic
*
* @return Requested font
*/
texture_font_t *
font_manager_get_from_description( font_manager_t * self,
const char * family,
const float size,
const int bold,
const int italic );
/**
* Request for a font based on a markup
*
* @param self a font manager
* @param markup Markup describing a font
*
* @return Requested font
*/
texture_font_t *
font_manager_get_from_markup( font_manager_t *self,
const markup_t *markup );
/**
* Search for a font filename that match description.
*
* @param self a font manager
* @param family font family
* @param size font size
* @param bold whether font is bold
* @param italic whether font is italic
*
* @return Requested font filename
*/
char *
font_manager_match_description( font_manager_t * self,
const char * family,
const float size,
const int bold,
const int italic );
/** @} */
#ifdef __cplusplus
}
#endif // ifdef __cplusplus
#endif /* __FONT_MANAGER_H__ */

+ 0
- 241
dgl/src/freetype-gl/freetype-errors.h View File

@@ -1,241 +0,0 @@

/* this macro is used to define an error */
#define FT_ERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )

/* this is only used for <module>_Err_Ok, which must be 0! */
#define FT_NOERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )

FT_ERROR_START_LIST

/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** LIST OF ERROR CODES/MESSAGES *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/

/* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */
/* including this file. */

/* generic errors */

FT_NOERRORDEF_( Ok, 0x00, \
"no error" )

FT_ERRORDEF_( Cannot_Open_Resource, 0x01, \
"cannot open resource" )
FT_ERRORDEF_( Unknown_File_Format, 0x02, \
"unknown file format" )
FT_ERRORDEF_( Invalid_File_Format, 0x03, \
"broken file" )
FT_ERRORDEF_( Invalid_Version, 0x04, \
"invalid FreeType version" )
FT_ERRORDEF_( Lower_Module_Version, 0x05, \
"module version is too low" )
FT_ERRORDEF_( Invalid_Argument, 0x06, \
"invalid argument" )
FT_ERRORDEF_( Unimplemented_Feature, 0x07, \
"unimplemented feature" )
FT_ERRORDEF_( Invalid_Table, 0x08, \
"broken table" )
FT_ERRORDEF_( Invalid_Offset, 0x09, \
"broken offset within table" )
FT_ERRORDEF_( Array_Too_Large, 0x0A, \
"array allocation size too large" )
FT_ERRORDEF_( Missing_Module, 0x0B, \
"missing module" )
FT_ERRORDEF_( Missing_Property, 0x0C, \
"missing property" )

/* glyph/character errors */

FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, \
"invalid glyph index" )
FT_ERRORDEF_( Invalid_Character_Code, 0x11, \
"invalid character code" )
FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, \
"unsupported glyph image format" )
FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, \
"cannot render this glyph format" )
FT_ERRORDEF_( Invalid_Outline, 0x14, \
"invalid outline" )
FT_ERRORDEF_( Invalid_Composite, 0x15, \
"invalid composite glyph" )
FT_ERRORDEF_( Too_Many_Hints, 0x16, \
"too many hints" )
FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, \
"invalid pixel size" )

/* handle errors */

FT_ERRORDEF_( Invalid_Handle, 0x20, \
"invalid object handle" )
FT_ERRORDEF_( Invalid_Library_Handle, 0x21, \
"invalid library handle" )
FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, \
"invalid module handle" )
FT_ERRORDEF_( Invalid_Face_Handle, 0x23, \
"invalid face handle" )
FT_ERRORDEF_( Invalid_Size_Handle, 0x24, \
"invalid size handle" )
FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, \
"invalid glyph slot handle" )
FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, \
"invalid charmap handle" )
FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, \
"invalid cache manager handle" )
FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, \
"invalid stream handle" )

/* driver errors */

FT_ERRORDEF_( Too_Many_Drivers, 0x30, \
"too many modules" )
FT_ERRORDEF_( Too_Many_Extensions, 0x31, \
"too many extensions" )

/* memory errors */

FT_ERRORDEF_( Out_Of_Memory, 0x40, \
"out of memory" )
FT_ERRORDEF_( Unlisted_Object, 0x41, \
"unlisted object" )

/* stream errors */

FT_ERRORDEF_( Cannot_Open_Stream, 0x51, \
"cannot open stream" )
FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, \
"invalid stream seek" )
FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, \
"invalid stream skip" )
FT_ERRORDEF_( Invalid_Stream_Read, 0x54, \
"invalid stream read" )
FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, \
"invalid stream operation" )
FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, \
"invalid frame operation" )
FT_ERRORDEF_( Nested_Frame_Access, 0x57, \
"nested frame access" )
FT_ERRORDEF_( Invalid_Frame_Read, 0x58, \
"invalid frame read" )

/* raster errors */

FT_ERRORDEF_( Raster_Uninitialized, 0x60, \
"raster uninitialized" )
FT_ERRORDEF_( Raster_Corrupted, 0x61, \
"raster corrupted" )
FT_ERRORDEF_( Raster_Overflow, 0x62, \
"raster overflow" )
FT_ERRORDEF_( Raster_Negative_Height, 0x63, \
"negative height while rastering" )

/* cache errors */

FT_ERRORDEF_( Too_Many_Caches, 0x70, \
"too many registered caches" )

/* TrueType and SFNT errors */

FT_ERRORDEF_( Invalid_Opcode, 0x80, \
"invalid opcode" )
FT_ERRORDEF_( Too_Few_Arguments, 0x81, \
"too few arguments" )
FT_ERRORDEF_( Stack_Overflow, 0x82, \
"stack overflow" )
FT_ERRORDEF_( Code_Overflow, 0x83, \
"code overflow" )
FT_ERRORDEF_( Bad_Argument, 0x84, \
"bad argument" )
FT_ERRORDEF_( Divide_By_Zero, 0x85, \
"division by zero" )
FT_ERRORDEF_( Invalid_Reference, 0x86, \
"invalid reference" )
FT_ERRORDEF_( Debug_OpCode, 0x87, \
"found debug opcode" )
FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, \
"found ENDF opcode in execution stream" )
FT_ERRORDEF_( Nested_DEFS, 0x89, \
"nested DEFS" )
FT_ERRORDEF_( Invalid_CodeRange, 0x8A, \
"invalid code range" )
FT_ERRORDEF_( Execution_Too_Long, 0x8B, \
"execution context too long" )
FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, \
"too many function definitions" )
FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, \
"too many instruction definitions" )
FT_ERRORDEF_( Table_Missing, 0x8E, \
"SFNT font table missing" )
FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, \
"horizontal header (hhea) table missing" )
FT_ERRORDEF_( Locations_Missing, 0x90, \
"locations (loca) table missing" )
FT_ERRORDEF_( Name_Table_Missing, 0x91, \
"name table missing" )
FT_ERRORDEF_( CMap_Table_Missing, 0x92, \
"character map (cmap) table missing" )
FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, \
"horizontal metrics (hmtx) table missing" )
FT_ERRORDEF_( Post_Table_Missing, 0x94, \
"PostScript (post) table missing" )
FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, \
"invalid horizontal metrics" )
FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, \
"invalid character map (cmap) format" )
FT_ERRORDEF_( Invalid_PPem, 0x97, \
"invalid ppem value" )
FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, \
"invalid vertical metrics" )
FT_ERRORDEF_( Could_Not_Find_Context, 0x99, \
"could not find context" )
FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, \
"invalid PostScript (post) table format" )
FT_ERRORDEF_( Invalid_Post_Table, 0x9B, \
"invalid PostScript (post) table" )

/* CFF, CID, and Type 1 errors */

FT_ERRORDEF_( Syntax_Error, 0xA0, \
"opcode syntax error" )
FT_ERRORDEF_( Stack_Underflow, 0xA1, \
"argument stack underflow" )
FT_ERRORDEF_( Ignore, 0xA2, \
"ignore" )
FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, \
"no Unicode glyph name found" )
FT_ERRORDEF_( Glyph_Too_Big, 0xA4, \
"glyph to big for hinting" )

/* BDF errors */

FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, \
"`STARTFONT' field missing" )
FT_ERRORDEF_( Missing_Font_Field, 0xB1, \
"`FONT' field missing" )
FT_ERRORDEF_( Missing_Size_Field, 0xB2, \
"`SIZE' field missing" )
FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3, \
"`FONTBOUNDINGBOX' field missing" )
FT_ERRORDEF_( Missing_Chars_Field, 0xB4, \
"`CHARS' field missing" )
FT_ERRORDEF_( Missing_Startchar_Field, 0xB5, \
"`STARTCHAR' field missing" )
FT_ERRORDEF_( Missing_Encoding_Field, 0xB6, \
"`ENCODING' field missing" )
FT_ERRORDEF_( Missing_Bbx_Field, 0xB7, \
"`BBX' field missing" )
FT_ERRORDEF_( Bbx_Too_Big, 0xB8, \
"`BBX' too big" )
FT_ERRORDEF_( Corrupted_Font_Header, 0xB9, \
"Font header corrupted or missing fields" )
FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA, \
"Font glyphs corrupted or missing fields" )

/* END */

FT_ERROR_END_LIST

+ 0
- 44
dgl/src/freetype-gl/freetype-gl.h View File

@@ -1,44 +0,0 @@
/* ============================================================================
* Freetype GL - A C OpenGL Freetype engine
* Platform: Any
* WWW: http://code.google.com/p/freetype-gl/
* ----------------------------------------------------------------------------
* Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Nicolas P. Rougier.
* ============================================================================
*/
#ifndef __FREETYPE_GL_H__
#define __FREETYPE_GL_H__

/* Mandatory */
#include "opengl.h"
#include "vec234.h"
#include "vector.h"
#include "texture-atlas.h"
#include "texture-font.h"

#endif /* FREETYPE_GL_H */

+ 0
- 191
dgl/src/freetype-gl/markup.h View File

@@ -1,191 +0,0 @@
/* =========================================================================
* Freetype GL - A C OpenGL Freetype engine
* Platform: Any
* WWW: http://code.google.com/p/freetype-gl/
* -------------------------------------------------------------------------
* Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Nicolas P. Rougier.
* ========================================================================= */
#ifndef __MARKUP_H__
#define __MARKUP_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "texture-font.h"
#include "vec234.h"
/**
* @file markup.h
* @author Nicolas Rougier (Nicolas.Rougier@inria.fr)
*
* @defgroup markup Markup
*
* Simple structure that describes text properties.
*
* <b>Example Usage</b>:
* @code
* #include "markup.h"
*
* ...
*
* vec4 black = {{0.0, 0.0, 0.0, 1.0}};
* vec4 white = {{1.0, 1.0, 1.0, 1.0}};
* vec4 none = {{1.0, 1.0, 1.0, 0.0}};
*
* markup_t normal = {
* .family = "Droid Serif",
* .size = 24.0,
* .bold = 0,
* .italic = 0,
* .rise = 0.0,
* .spacing = 1.0,
* .gamma = 1.0,
* .foreground_color = black, .background_color = none,
* .underline = 0, .underline_color = black,
* .overline = 0, .overline_color = black,
* .strikethrough = 0, .strikethrough_color = black,
* .font = 0,
* };
*
* ...
*
* @endcode
*
* @{
*/
/**
* Simple structure that describes text properties.
*/
typedef struct markup_t
{
/**
* A font family name such as "normal", "sans", "serif" or "monospace".
*/
char * family;
/**
* Font size.
*/
float size;
/**
* Whether text is bold.
*/
int bold;
/**
* Whether text is italic.
*/
int italic;
/**
* Vertical displacement from the baseline.
*/
float rise;
/**
* Spacing between letters.
*/
float spacing;
/**
* Gamma correction.
*/
float gamma;
/**
* Text color.
*/
vec4 foreground_color;
/**
* Background color.
*/
vec4 background_color;
/**
* Whether outline is active.
*/
int outline;
/**
* Outline color.
*/
vec4 outline_color;
/**
* Whether underline is active.
*/
int underline;
/**
* Underline color.
*/
vec4 underline_color;
/**
* Whether overline is active.
*/
int overline;
/**
* Overline color.
*/
vec4 overline_color;
/**
* Whether strikethrough is active.
*/
int strikethrough;
/**
* Strikethrough color.
*/
vec4 strikethrough_color;
/**
* Pointer on the corresponding font (family/size/bold/italic)
*/
texture_font_t * font;
} markup_t;
extern markup_t default_markup;
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* __MARKUP_H__ */

+ 0
- 263
dgl/src/freetype-gl/mat4.c View File

@@ -1,263 +0,0 @@
/* ============================================================================
* Freetype GL - A C OpenGL Freetype engine
* Platform: Any
* WWW: http://code.google.com/p/freetype-gl/
* ----------------------------------------------------------------------------
* Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Nicolas P. Rougier.
* ============================================================================
*/
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "mat4.h"

#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif

mat4 *
mat4_new( void )
{
mat4 *self = (mat4 *) malloc( sizeof(mat4) );
return self;

}

void
mat4_set_zero( mat4 *self )
{
assert( self );

memset( self, 0, sizeof( mat4 ));
}

void
mat4_set_identity( mat4 *self )
{
assert( self );

memset( self, 0, sizeof( mat4 ));
self->m00 = 1.0;
self->m11 = 1.0;
self->m22 = 1.0;
self->m33 = 1.0;
}

void
mat4_multiply( mat4 *self, mat4 *other )
{
mat4 m;
size_t i;

assert( self );
assert( other );

for( i=0; i<4; ++i )
{
m.data[i*4+0] =
(self->data[i*4+0] * other->data[0*4+0]) +
(self->data[i*4+1] * other->data[1*4+0]) +
(self->data[i*4+2] * other->data[2*4+0]) +
(self->data[i*4+3] * other->data[3*4+0]) ;

m.data[i*4+1] =
(self->data[i*4+0] * other->data[0*4+1]) +
(self->data[i*4+1] * other->data[1*4+1]) +
(self->data[i*4+2] * other->data[2*4+1]) +
(self->data[i*4+3] * other->data[3*4+1]) ;
m.data[i*4+2] =
(self->data[i*4+0] * other->data[0*4+2]) +
(self->data[i*4+1] * other->data[1*4+2]) +
(self->data[i*4+2] * other->data[2*4+2]) +
(self->data[i*4+3] * other->data[3*4+2]) ;
m.data[i*4+3] =
(self->data[i*4+0] * other->data[0*4+3]) +
(self->data[i*4+1] * other->data[1*4+3]) +
(self->data[i*4+2] * other->data[2*4+3]) +
(self->data[i*4+3] * other->data[3*4+3]) ;
}
memcpy( self, &m, sizeof( mat4 ) );

}


void
mat4_set_orthographic( mat4 *self,
float left, float right,
float bottom, float top,
float znear, float zfar )
{
assert( self );
assert( right != left );
assert( bottom != top );
assert( znear != zfar );

mat4_set_zero( self );

self->m00 = +2.0/(right-left);
self->m30 = -(right+left)/(right-left);
self->m11 = +2.0/(top-bottom);
self->m31 = -(top+bottom)/(top-bottom);
self->m22 = -2.0/(zfar-znear);
self->m32 = -(zfar+znear)/(zfar-znear);
self->m33 = 1.0;
}

void
mat4_set_perspective( mat4 *self,
float fovy, float aspect,
float znear, float zfar)
{
float h, w;
assert( self );
assert( znear != zfar );

h = tan(fovy / 360.0 * M_PI) * znear;
w = h * aspect;
mat4_set_frustum( self, -w, w, -h, h, znear, zfar );
}

void
mat4_set_frustum( mat4 *self,
float left, float right,
float bottom, float top,
float znear, float zfar )
{
assert( self );
assert( right != left );
assert( bottom != top );
assert( znear != zfar );

mat4_set_zero( self );

self->m00 = (2.0*znear)/(right-left);
self->m20 = (right+left)/(right-left);

self->m11 = (2.0*znear)/(top-bottom);
self->m21 = (top+bottom)/(top-bottom);

self->m22 = -(zfar+znear)/(zfar-znear);
self->m32 = -(2.0*zfar*znear)/(zfar-znear);

self->m23 = -1.0;
}

void
mat4_set_rotation( mat4 *self,
float angle,
float x, float y, float z)
{
float c, s, norm;
assert( self );

c = cos( M_PI*angle/180.0 );
s = sin( M_PI*angle/180.0 );
norm = sqrt(x*x+y*y+z*z);

x /= norm; y /= norm; z /= norm;

mat4_set_identity( self );

self->m00 = x*x*(1-c)+c;
self->m10 = y*x*(1-c)-z*s;
self->m20 = z*x*(1-c)+y*s;

self->m01 = x*y*(1-c)+z*s;
self->m11 = y*y*(1-c)+c;
self->m21 = z*y*(1-c)-x*s;

self->m02 = x*z*(1-c)-y*s;
self->m12 = y*z*(1-c)+x*s;
self->m22 = z*z*(1-c)+c;
}

void
mat4_set_translation( mat4 *self,
float x, float y, float z)
{
assert( self );

mat4_set_identity( self );
self-> m30 = x;
self-> m31 = y;
self-> m32 = z;
}

void
mat4_set_scaling( mat4 *self,
float x, float y, float z)
{
assert( self );

mat4_set_identity( self );
self-> m00 = x;
self-> m11 = y;
self-> m22 = z;
}

void
mat4_rotate( mat4 *self,
float angle,
float x, float y, float z)
{
mat4 m;
assert( self );

mat4_set_rotation( &m, angle, x, y, z);
mat4_multiply( self, &m );
}

void
mat4_translate( mat4 *self,
float x, float y, float z)
{
mat4 m;
assert( self );

mat4_set_translation( &m, x, y, z);
mat4_multiply( self, &m );
}

void
mat4_scale( mat4 *self,
float x, float y, float z)
{
mat4 m;
assert( self );

mat4_set_scaling( &m, x, y, z);
mat4_multiply( self, &m );
}

+ 0
- 117
dgl/src/freetype-gl/mat4.h View File

@@ -1,117 +0,0 @@
/* ============================================================================
* Freetype GL - A C OpenGL Freetype engine
* Platform: Any
* WWW: http://code.google.com/p/freetype-gl/
* ----------------------------------------------------------------------------
* Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Nicolas P. Rougier.
* ============================================================================
*/
#ifndef __MAT4_H__
#define __MAT4_H__

#ifdef __cplusplus
extern "C" {
#endif


/**
*
*/
typedef union
{
float data[16]; /**< All compoments at once */
struct {
float m00, m01, m02, m03;
float m10, m11, m12, m13;
float m20, m21, m22, m23;
float m30, m31, m32, m33;
};
} mat4;


mat4 *
mat4_new( void );

void
mat4_set_identity( mat4 *self );

void
mat4_set_zero( mat4 *self );

void
mat4_multiply( mat4 *self, mat4 *other );

void
mat4_set_orthographic( mat4 *self,
float left, float right,
float bottom, float top,
float znear, float zfar );

void
mat4_set_perspective( mat4 *self,
float fovy, float aspect,
float zNear, float zFar);

void
mat4_set_frustum( mat4 *self,
float left, float right,
float bottom, float top,
float znear, float zfar );

void
mat4_set_rotation( mat4 *self,
float angle,
float x, float y, float z);

void
mat4_set_translation( mat4 *self,
float x, float y, float z);

void
mat4_set_scaling( mat4 *self,
float x, float y, float z);

void
mat4_rotate( mat4 *self,
float angle,
float x, float y, float z);

void
mat4_translate( mat4 *self,
float x, float y, float z);

void
mat4_scale( mat4 *self,
float x, float y, float z);


#ifdef __cplusplus
}
#endif

#endif /* __MAT4_H__ */

+ 0
- 37
dgl/src/freetype-gl/opengl.h View File

@@ -1,37 +0,0 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include "../../../distrho/src/DistrhoDefines.h"

/* GL includes */
#ifdef DISTRHO_OS_MAC
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
#endif

/* missing GL defines */
#if defined(GL_BGR_EXT) && ! defined(GL_BGR)
# define GL_BGR GL_BGR_EXT
#endif

#if defined(GL_BGRA_EXT) && ! defined(GL_BGRA)
# define GL_BGRA GL_BGRA_EXT
#endif

#ifndef GL_CLAMP_TO_BORDER
# define GL_CLAMP_TO_BORDER 0x812D
#endif

+ 0
- 71
dgl/src/freetype-gl/platform.h View File

@@ -1,71 +0,0 @@
/* ============================================================================
* Freetype GL - A C OpenGL Freetype engine
* Platform: Any
* WWW: http://code.google.com/p/freetype-gl/
* ----------------------------------------------------------------------------
* Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Nicolas P. Rougier.
* ============================================================================
*/
#ifndef __PLATFORM_H__
#define __PLATFORM_H__
#include <stdlib.h>
//-------------------------------------------------
// stdint.h is not available on VS2008 or lower
//-------------------------------------------------
#ifdef _MSC_VER
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif // _MSC_VER
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __APPLE__
/* strndup() was only added in OSX lion */
char * strndup( const char *s1, size_t n);
#elif defined(_WIN32) || defined(_WIN64)
/* does not exist on windows */
char * strndup( const char *s1, size_t n);
# if !defined(_MSC_VER) || _MSC_VER < 1800
double round(double v);
# endif // _MSC_VER
# pragma warning (disable: 4244) // suspend warnings
#endif // _WIN32 || _WIN64
#ifdef __cplusplus
}
#endif // __cplusplus
#endif /* __PLATFORM_H__ */

+ 0
- 124
dgl/src/freetype-gl/shader.c View File

@@ -1,124 +0,0 @@
// ----------------------------------------------------------------------------
// OpenGL Anti-Grain Geometry (GL-AGG) - Version 0.1
// A high quality OpenGL rendering engine for C
// Copyright (C) 2012 Nicolas P. Rougier. All rights reserved.
// Contact: Nicolas.Rougier@gmail.com
// http://code.google.com/p/gl-agg/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are
// those of the authors and should not be interpreted as representing official
// policies, either expressed or implied, of Nicolas P. Rougier.
// ----------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "opengl.h"
#include "shader.h"


// ------------------------------------------------------------ shader_read ---
char *
shader_read( const char *filename )
{
FILE * file;
char * buffer;
size_t size;

file = fopen( filename, "rb" );
if( !file )
{
fprintf( stderr, "Unable to open file \"%s\".\n", filename );
return 0;
}
fseek( file, 0, SEEK_END );
size = ftell( file );
fseek(file, 0, SEEK_SET );
buffer = (char *) malloc( (size+1) * sizeof( char *) );
fread( buffer, sizeof(char), size, file );
buffer[size] = 0;
fclose( file );
return buffer;
}



// --------------------------------------------------------- shader_compile ---
GLuint
shader_compile( const char* source,
const GLenum type )
{
GLint compile_status;
GLuint handle = glCreateShader( type );
glShaderSource( handle, 1, &source, 0 );
glCompileShader( handle );

glGetShaderiv( handle, GL_COMPILE_STATUS, &compile_status );
if( compile_status == GL_FALSE )
{
GLchar messages[256];
glGetShaderInfoLog( handle, sizeof(messages), 0, &messages[0] );
fprintf( stderr, "%s\n", messages );
exit( EXIT_FAILURE );
}
return handle;
}


// ------------------------------------------------------------ shader_load ---
GLuint
shader_load( const char * vert_filename,
const char * frag_filename )
{
GLuint handle = glCreateProgram( );
GLint link_status;

if( vert_filename && strlen( vert_filename ) )
{
char *vert_source = shader_read( vert_filename );
GLuint vert_shader = shader_compile( vert_source, GL_VERTEX_SHADER);
glAttachShader( handle, vert_shader);
glDeleteShader( vert_shader );
free( vert_source );
}
if( frag_filename && strlen( frag_filename ) )
{
char *frag_source = shader_read( frag_filename );
GLuint frag_shader = shader_compile( frag_source, GL_FRAGMENT_SHADER);
glAttachShader( handle, frag_shader);
glDeleteShader( frag_shader );
free( frag_source );
}

glLinkProgram( handle );

glGetProgramiv( handle, GL_LINK_STATUS, &link_status );
if (link_status == GL_FALSE)
{
GLchar messages[256];
glGetProgramInfoLog( handle, sizeof(messages), 0, &messages[0] );
fprintf( stderr, "%s\n", messages );
exit(1);
}
return handle;
}

+ 0
- 119
dgl/src/freetype-gl/shader.h View File

@@ -1,119 +0,0 @@
/* ============================================================================
* Freetype GL - A C OpenGL Freetype engine
* Platform: Any
* WWW: http://code.google.com/p/freetype-gl/
* ----------------------------------------------------------------------------
* Copyright 2011,2012,2013 Nicolas P. Rougier. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Nicolas P. Rougier.
* ----------------------------------------------------------------------------
*/
#ifndef __SHADER_H__
#define __SHADER_H__

#include "opengl.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @file shader.h
* @author Nicolas Rougier (Nicolas.Rougier@inria.fr)
*
* @defgroup shader Shader
*
* Simple functions for loading/building a shader from sources.
*
* <b>Example Usage</b>:
* @code
* #include "shader.h"
*
* int main( int arrgc, char *argv[] )
* {
* GLuint shader = shader_load("shader.vert", "shader.frag");
*
* return 0;
* }
* @endcode
*
* @{
*/

/**
* Read a fragment or vertex shader from a file
*
* @param filename file to read shader from
* @return a newly-allocated text buffer containing code. This buffer
* must be freed after usage.
*
*/
char *
shader_read( const char *filename );


/**
* Compile a shader from a text buffer.
*
* @param source code of the shader
* @param type type of the shader
*
* @return a handle on the compiled program
*
*/
GLuint
shader_compile( const char* source,
const GLenum type );


/**
* Load a vertex and fragment shader sources and build program
*
* @param vert_filename vertex shader filename
* @param frag_filename fragment shader filename
*
* @return a handle on the built program
*
*/
GLuint
shader_load( const char * vert_filename,
const char * frag_filename );


/**
*
*/
GLuint
shader_get( GLuint self,
const char * name );

/** @} */

#ifdef __cplusplus
}
#endif

#endif /* __SHADER_H__ */

+ 0
- 448
dgl/src/freetype-gl/text-buffer.c View File

@@ -1,448 +0,0 @@
/* ============================================================================
* Freetype GL - A C OpenGL Freetype engine
* Platform: Any
* WWW: http://code.google.com/p/freetype-gl/
* ----------------------------------------------------------------------------
* Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of Nicolas P. Rougier.
* ============================================================================
*/
#include <wchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include "opengl.h"
#include "text-buffer.h"


#define SET_GLYPH_VERTEX(value,x0,y0,z0,s0,t0,r,g,b,a,sh,gm) { \
glyph_vertex_t *gv=&value; \
gv->x=x0; gv->y=y0; gv->z=z0; \
gv->u=s0; gv->v=t0; \
gv->r=r; gv->g=g; gv->b=b; gv->a=a; \
gv->shift=sh; gv->gamma=gm;}


// ----------------------------------------------------------------------------
text_buffer_t *
text_buffer_new( size_t depth )
{
text_buffer_t *self = (text_buffer_t *) malloc (sizeof(text_buffer_t));
self->buffer = vertex_buffer_new(
"vertex:3f,tex_coord:2f,color:4f,ashift:1f,agamma:1f" );
self->manager = font_manager_new( 512, 512, depth );
self->shader = shader_load("shaders/text.vert",
"shaders/text.frag");
self->shader_texture = glGetUniformLocation(self->shader, "texture");
self->shader_pixel = glGetUniformLocation(self->shader, "pixel");
self->line_start = 0;
self->line_ascender = 0;
self->base_color.r = 0.0;
self->base_color.g = 0.0;
self->base_color.b = 0.0;
self->base_color.a = 1.0;
self->line_descender = 0;
return self;
}

// ----------------------------------------------------------------------------
void
text_buffer_delete( text_buffer_t * self )
{
vertex_buffer_delete( self->buffer );
glDeleteProgram( self->shader );
free( self );
}

// ----------------------------------------------------------------------------
void
text_buffer_clear( text_buffer_t * self )
{
assert( self );

vertex_buffer_clear( self->buffer );
self->line_start = 0;
self->line_ascender = 0;
self->line_descender = 0;
}


// ----------------------------------------------------------------------------
void
text_buffer_render( text_buffer_t * self )
{
glEnable( GL_BLEND );

glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, self->manager->atlas->id );

if( self->manager->atlas->depth == 1 )
{
//glDisable( GL_COLOR_MATERIAL );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glBlendColor( 1, 1, 1, 1 );
}
else
{
//glEnable( GL_COLOR_MATERIAL );
//glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
//glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
//glBlendColor( 1.0, 1.0, 1.0, 1.0 );
//glBlendFunc( GL_CONSTANT_COLOR_EXT, GL_ONE_MINUS_SRC_COLOR );
//glBlendColor( self->base_color.r,
//self->base_color.g,
//self->base_color.b,
//self->base_color.a );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glBlendColor( 1, 1, 1, 1 );
}

glUseProgram( self->shader );
glUniform1i( self->shader_texture, 0 );
glUniform3f( self->shader_pixel,
1.0/self->manager->atlas->width,
1.0/self->manager->atlas->height,
self->manager->atlas->depth );
vertex_buffer_render( self->buffer, GL_TRIANGLES );
glUseProgram( 0 );
}

// ----------------------------------------------------------------------------
void
text_buffer_printf( text_buffer_t * self, vec2 *pen, ... )
{
markup_t *markup;
wchar_t *text;
va_list args;

if( vertex_buffer_size( self->buffer ) == 0 )
{
self->origin = *pen;
}

va_start ( args, pen );
do {
markup = va_arg( args, markup_t * );
if( markup == NULL )
{
return;
}
text = va_arg( args, wchar_t * );
text_buffer_add_text( self, pen, markup, text, wcslen(text) );
} while( markup != 0 );
va_end ( args );
}

// ----------------------------------------------------------------------------
void
text_buffer_move_last_line( text_buffer_t * self, float dy )
{
size_t i, j;
for( i=self->line_start; i < vector_size( self->buffer->items ); ++i )
{
ivec4 *item = (ivec4 *) vector_get( self->buffer->items, i);
for( j=item->vstart; j<item->vstart+item->vcount; ++j)
{
glyph_vertex_t * vertex =
(glyph_vertex_t *) vector_get( self->buffer->vertices, j );
vertex->y -= dy;
}
}
}


// ----------------------------------------------------------------------------
void
text_buffer_add_text( text_buffer_t * self,
vec2 * pen, markup_t * markup,
wchar_t * text, size_t length )
{
font_manager_t * manager = self->manager;
size_t i;

if( markup == NULL )
{
return;
}

if( !markup->font )
{
markup->font = font_manager_get_from_markup( manager, markup );
if( ! markup->font )
{
fprintf( stderr, "Houston, we've got a problem !\n" );
exit( EXIT_FAILURE );
}
}

if( length == 0 )
{
length = wcslen(text);
}
if( vertex_buffer_size( self->buffer ) == 0 )
{
self->origin = *pen;
}

text_buffer_add_wchar( self, pen, markup, text[0], 0 );
for( i=1; i<length; ++i )
{
text_buffer_add_wchar( self, pen, markup, text[i], text[i-1] );
}
}

// ----------------------------------------------------------------------------
void
text_buffer_add_wchar( text_buffer_t * self,
vec2 * pen, markup_t * markup,
wchar_t current, wchar_t previous )
{
size_t vcount = 0;
size_t icount = 0;
vertex_buffer_t * buffer = self->buffer;
texture_font_t * font = markup->font;
float gamma = markup->gamma;

// Maximum number of vertices is 20 (= 5x2 triangles) per glyph:
// - 2 triangles for background
// - 2 triangles for overline
// - 2 triangles for underline
// - 2 triangles for strikethrough
// - 2 triangles for glyph
glyph_vertex_t vertices[4*5];
GLuint indices[6*5];
texture_glyph_t *glyph;
texture_glyph_t *black;
float kerning = 0;
if( current == L'\n' )
{
pen->x = self->origin.x;
pen->y += self->line_descender;
self->line_descender = 0;
self->line_ascender = 0;
self->line_start = vector_size( self->buffer->items );
return;
}

if( markup->font->ascender > self->line_ascender )
{
float y = pen->y;
pen->y -= (markup->font->ascender - self->line_ascender);
text_buffer_move_last_line( self, (int)(y-pen->y) );
self->line_ascender = markup->font->ascender;
}
if( markup->font->descender < self->line_descender )
{
self->line_descender = markup->font->descender;
}

glyph = texture_font_get_glyph( font, current );
black = texture_font_get_glyph( font, -1 );
if( glyph == NULL )
{
return;
}
if( previous && markup->font->kerning )
{
kerning = texture_glyph_get_kerning( glyph, previous );
}
pen->x += kerning;
// Background
if( markup->background_color.alpha > 0 )
{
float r = markup->background_color.r;
float g = markup->background_color.g;
float b = markup->background_color.b;
float a = markup->background_color.a;
float x0 = ( pen->x -kerning );
float y0 = (int)( pen->y + font->descender );
float x1 = ( x0 + glyph->advance_x );
float y1 = (int)( y0 + font->height + font->linegap );
float s0 = black->s0;
float t0 = black->t0;
float s1 = black->s1;
float t1 = black->t1;

SET_GLYPH_VERTEX(vertices[vcount+0],
(int)x0,y0,0, s0,t0, r,g,b,a, x0-((int)x0), gamma );
SET_GLYPH_VERTEX(vertices[vcount+1],
(int)x0,y1,0, s0,t1, r,g,b,a, x0-((int)x0), gamma );
SET_GLYPH_VERTEX(vertices[vcount+2],
(int)x1,y1,0, s1,t1, r,g,b,a, x1-((int)x1), gamma );
SET_GLYPH_VERTEX(vertices[vcount+3],
(int)x1,y0,0, s1,t0, r,g,b,a, x1-((int)x1), gamma );
indices[icount + 0] = vcount+0;
indices[icount + 1] = vcount+1;
indices[icount + 2] = vcount+2;
indices[icount + 3] = vcount+0;
indices[icount + 4] = vcount+2;
indices[icount + 5] = vcount+3;
vcount += 4;
icount += 6;
}
// Underline
if( markup->underline )
{
float r = markup->underline_color.r;
float g = markup->underline_color.g;
float b = markup->underline_color.b;
float a = markup->underline_color.a;
float x0 = ( pen->x - kerning );
float y0 = (int)( pen->y + font->underline_position );
float x1 = ( x0 + glyph->advance_x );
float y1 = (int)( y0 + font->underline_thickness );
float s0 = black->s0;
float t0 = black->t0;
float s1 = black->s1;
float t1 = black->t1;

SET_GLYPH_VERTEX(vertices[vcount+0],
(int)x0,y0,0, s0,t0, r,g,b,a, x0-((int)x0), gamma );
SET_GLYPH_VERTEX(vertices[vcount+1],
(int)x0,y1,0, s0,t1, r,g,b,a, x0-((int)x0), gamma );
SET_GLYPH_VERTEX(vertices[vcount+2],
(int)x1,y1,0, s1,t1, r,g,b,a, x1-((int)x1), gamma );
SET_GLYPH_VERTEX(vertices[vcount+3],
(int)x1,y0,0, s1,t0, r,g,b,a, x1-((int)x1), gamma );
indices[icount + 0] = vcount+0;
indices[icount + 1] = vcount+1;
indices[icount + 2] = vcount+2;
indices[icount + 3] = vcount+0;
indices[icount + 4] = vcount+2;
indices[icount + 5] = vcount+3;
vcount += 4;
icount += 6;
}
// Overline
if( markup->overline )
{
float r = markup->overline_color.r;
float g = markup->overline_color.g;
float b = markup->overline_color.b;
float a = markup->overline_color.a;
float x0 = ( pen->x -kerning );
float y0 = (int)( pen->y + (int)font->ascender );
float x1 = ( x0 + glyph->advance_x );
float y1 = (int)( y0 + (int)font->underline_thickness );
float s0 = black->s0;
float t0 = black->t0;
float s1 = black->s1;
float t1 = black->t1;
SET_GLYPH_VERTEX(vertices[vcount+0],
(int)x0,y0,0, s0,t0, r,g,b,a, x0-((int)x0), gamma );
SET_GLYPH_VERTEX(vertices[vcount+1],
(int)x0,y1,0, s0,t1, r,g,b,a, x0-((int)x0), gamma );
SET_GLYPH_VERTEX(vertices[vcount+2],
(int)x1,y1,0, s1,t1, r,g,b,a, x1-((int)x1), gamma );
SET_GLYPH_VERTEX(vertices[vcount+3],
(int)x1,y0,0, s1,t0, r,g,b,a, x1-((int)x1), gamma );
indices[icount + 0] = vcount+0;
indices[icount + 1] = vcount+1;
indices[icount + 2] = vcount+2;
indices[icount + 3] = vcount+0;
indices[icount + 4] = vcount+2;
indices[icount + 5] = vcount+3;
vcount += 4;
icount += 6;
}