1 /***************************************************************************/ 2 /* */ 3 /* afshaper.c */ 4 /* */ 5 /* HarfBuzz interface for accessing OpenType features (body). */ 6 /* */ 7 /* Copyright 2013-2018 by */ 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 /* */ 10 /* This file is part of the FreeType project, and may only be used, */ 11 /* modified, and distributed under the terms of the FreeType project */ 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 /* this file you indicate that you have read the license and */ 14 /* understand and accept it fully. */ 15 /* */ 16 /***************************************************************************/ 17 18 19 #include <ft2build.h> 20 #include FT_FREETYPE_H 21 #include FT_ADVANCES_H 22 #include "afglobal.h" 23 #include "aftypes.h" 24 #include "afshaper.h" 25 26 #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ 27 28 29 /*************************************************************************/ 30 /* */ 31 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ 32 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ 33 /* messages during execution. */ 34 /* */ 35 #undef FT_COMPONENT 36 #define FT_COMPONENT trace_afshaper 37 38 39 /* 40 * We use `sets' (in the HarfBuzz sense, which comes quite near to the 41 * usual mathematical meaning) to manage both lookups and glyph indices. 42 * 43 * 1. For each coverage, collect lookup IDs in a set. Note that an 44 * auto-hinter `coverage' is represented by one `feature', and a 45 * feature consists of an arbitrary number of (font specific) `lookup's 46 * that actually do the mapping job. Please check the OpenType 47 * specification for more details on features and lookups. 48 * 49 * 2. Create glyph ID sets from the corresponding lookup sets. 50 * 51 * 3. The glyph set corresponding to AF_COVERAGE_DEFAULT is computed 52 * with all lookups specific to the OpenType script activated. It 53 * relies on the order of AF_DEFINE_STYLE_CLASS entries so that 54 * special coverages (like `oldstyle figures') don't get overwritten. 55 * 56 */ 574 575 576 FT_Error 577 af_shaper_get_coverage( AF_FaceGlobals globals, 578 AF_StyleClass style_class, 579 FT_UShort* gstyles, 580 FT_Bool default_script ) 581 { 582 FT_UNUSED( globals ); 583 FT_UNUSED( style_class ); 584 FT_UNUSED( gstyles ); 585 FT_UNUSED( default_script ); 586 587 return FT_Err_Ok; 588 } 589 590 591 void* 592 af_shaper_buf_create( FT_Face face ) 593 { 594 FT_Error error; 595 FT_Memory memory = face->memory; 596 FT_ULong* buf; 597 598 599 FT_MEM_ALLOC( buf, sizeof ( FT_ULong ) ); 600 601 return (void*)buf; 602 } 603 604 605 void 606 af_shaper_buf_destroy( FT_Face face, 607 void* buf ) 608 { 609 FT_Memory memory = face->memory; 610 611 612 FT_FREE( buf ); 613 } 614 615 616 const char* 617 af_shaper_get_cluster( const char* p, 618 AF_StyleMetrics metrics, 619 void* buf_, 620 unsigned int* count ) 621 { 622 FT_Face face = metrics->globals->face; 623 FT_ULong ch, dummy = 0; 624 FT_ULong* buf = (FT_ULong*)buf_; 625 626 627 while ( *p == ' ' ) 628 p++; 629 630 GET_UTF8_CHAR( ch, p ); 631 632 /* since we don't have an engine to handle clusters, */ | 1 /**************************************************************************** 2 * 3 * afshaper.c 4 * 5 * HarfBuzz interface for accessing OpenType features (body). 6 * 7 * Copyright (C) 2013-2019 by 8 * David Turner, Robert Wilhelm, and Werner Lemberg. 9 * 10 * This file is part of the FreeType project, and may only be used, 11 * modified, and distributed under the terms of the FreeType project 12 * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 * this file you indicate that you have read the license and 14 * understand and accept it fully. 15 * 16 */ 17 18 19 #include <ft2build.h> 20 #include FT_FREETYPE_H 21 #include FT_ADVANCES_H 22 #include "afglobal.h" 23 #include "aftypes.h" 24 #include "afshaper.h" 25 26 #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ 27 28 29 /************************************************************************** 30 * 31 * The macro FT_COMPONENT is used in trace mode. It is an implicit 32 * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log 33 * messages during execution. 34 */ 35 #undef FT_COMPONENT 36 #define FT_COMPONENT afshaper 37 38 39 /* 40 * We use `sets' (in the HarfBuzz sense, which comes quite near to the 41 * usual mathematical meaning) to manage both lookups and glyph indices. 42 * 43 * 1. For each coverage, collect lookup IDs in a set. Note that an 44 * auto-hinter `coverage' is represented by one `feature', and a 45 * feature consists of an arbitrary number of (font specific) `lookup's 46 * that actually do the mapping job. Please check the OpenType 47 * specification for more details on features and lookups. 48 * 49 * 2. Create glyph ID sets from the corresponding lookup sets. 50 * 51 * 3. The glyph set corresponding to AF_COVERAGE_DEFAULT is computed 52 * with all lookups specific to the OpenType script activated. It 53 * relies on the order of AF_DEFINE_STYLE_CLASS entries so that 54 * special coverages (like `oldstyle figures') don't get overwritten. 55 * 56 */ 574 575 576 FT_Error 577 af_shaper_get_coverage( AF_FaceGlobals globals, 578 AF_StyleClass style_class, 579 FT_UShort* gstyles, 580 FT_Bool default_script ) 581 { 582 FT_UNUSED( globals ); 583 FT_UNUSED( style_class ); 584 FT_UNUSED( gstyles ); 585 FT_UNUSED( default_script ); 586 587 return FT_Err_Ok; 588 } 589 590 591 void* 592 af_shaper_buf_create( FT_Face face ) 593 { 594 FT_UNUSED( face ); 595 596 return NULL; 597 } 598 599 600 void 601 af_shaper_buf_destroy( FT_Face face, 602 void* buf ) 603 { 604 FT_UNUSED( face ); 605 FT_UNUSED( buf ); 606 } 607 608 609 const char* 610 af_shaper_get_cluster( const char* p, 611 AF_StyleMetrics metrics, 612 void* buf_, 613 unsigned int* count ) 614 { 615 FT_Face face = metrics->globals->face; 616 FT_ULong ch, dummy = 0; 617 FT_ULong* buf = (FT_ULong*)buf_; 618 619 620 while ( *p == ' ' ) 621 p++; 622 623 GET_UTF8_CHAR( ch, p ); 624 625 /* since we don't have an engine to handle clusters, */ |