提交 9f8da38c 编写于 作者: B Behdad Esfahbod 提交者: Behdad Esfahbod

Convert pango/opentype to the new project called HarfBuzz.

2006-03-31  Behdad Esfahbod  <behdad@gnome.org>

        Convert pango/opentype to the new project called HarfBuzz.

        * pango/opentype/*: Restructured.

        * pango/pango-ot-*: Updated to use HarfBuzz symbol names.
上级 dd2a8d4d
HarfBuzz is distributed under two mutually exclusive open-source licenses.
This means that *you* must choose *one* of the two licenses described
below, then obey all its terms and conditions when using HarfBuzz in
any of your projects or products.
- The FreeType License, found in the file `COPYING.FTL', which is similar to
the original BSD license *with* an advertising clause that forces you to
explicitly cite the FreeType project in your product's documentation.
All details are in the license file. This license is suited to
products which don't use the GNU General Public License.
- The GNU General Public License version 2, found in `COPYING.GPL' (any
later version can be used also), for programs which already use the GPL.
Note that the FTL is incompatible with the GPL due to its
advertisement clause.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
The FreeType 2 font engine is copyrighted work and cannot be used
legally without a software license. In order to make this project
usable to a vast majority of developers, we distribute it under two
mutually exclusive open-source licenses.
This means that *you* must choose *one* of the two licenses described
below, then obey all its terms and conditions when using FreeType 2 in
any of your projects or products.
- The FreeType License, found in the file `FTL.TXT', which is similar
to the original BSD license *with* an advertising clause that forces
you to explicitly cite the FreeType project in your product's
documentation. All details are in the license file. This license
is suited to products which don't use the GNU General Public
License.
- The GNU General Public License version 2, found in `GPL.TXT' (any
later version can be used also), for programs which already use the
GPL. Note that the FTL is incompatible with the GPL due to its
advertisement clause.
The contributed PCF driver comes with a license similar to that of the X
Window System. It is compatible to the above two licenses (see file
src/pcf/readme).
--- end of LICENSE.TXT ---
## Process this file with automake to produce Makefile.in
INCLUDES = \
-DSYSCONFDIR=\"$(sysconfdir)\" \
-DLIBDIR=\"$(libdir)\" \
$(PANGO_DEBUG_FLAGS) \
-I$(top_srcdir) \
$(GLIB_CFLAGS) \
$(FREETYPE_CFLAGS)
noinst_LTLIBRARIES = libmini-harfbuzz.la
libmini_harfbuzz_la_SOURCES = \
ftglue.h \
ftglue.c \
ftxopen.c \
ftxopen.h \
ftxopenf.h \
ftxgdef.c \
ftxgdef.h \
ftxgpos.c \
ftxgpos.h \
ftxgsub.c \
ftxgsub.h \
otlbuffer.c \
otlbuffer.h
libmini_harfbuzz_la_LIBADD = \
$(x_ldflags) \
$(x_libs) \
$(GLIB_LIBS) \
-lm
if BUILD_OT_TESTS
noinst_PROGRAMS = ottest
endif
ottest_SOURCES = \
ottest.c \
disasm.c \
disasm.h
ottest_LDADD = \
libmini-harfbuzz.la \
noinst_LTLIBRARIES = libharfbuzz-1.la
SOURCES = \
ftglue.c \
harfbuzz-buffer.c \
harfbuzz-dump.c \
harfbuzz-gdef.c \
harfbuzz-gpos.c \
harfbuzz-gsub.c \
harfbuzz-open.c
EXTRA_SOURCES = harfbuzz.c
PUBLICHEADERS = \
harfbuzz.h \
harfbuzz-buffer.h \
harfbuzz-dump.h \
harfbuzz-gdef.h \
harfbuzz-gpos.h \
harfbuzz-gsub.h \
harfbuzz-open.h
PRIVATEHEADERS = \
ftglue.h \
harfbuzz-impl.h \
harfbuzz-gdef-private.h \
harfbuzz-gpos-private.h \
harfbuzz-gsub-private.h \
harfbuzz-open-private.h
libharfbuzz_1_la_SOURCES = \
$(SOURCES) \
$(PUBLICHEADERS) \
$(PRIVATEHEADERS)
libharfbuzz_1_la_LIBADD = \
$(FREETYPE_LIBS)
noinst_PROGRAMS = harfbuzz-dump
harfbuzz_dump_SOURCES = \
harfbuzz-dump-main.c
harfbuzz_dump_LDADD = \
libharfbuzz-1.la
EXTRA_DIST = \
README \
FTL.TXT \
FT-license.txt
COPYING.FTL \
COPYING.GPL \
COPYING \
$(EXTRA_SOURCES)
This directory includes code for using OpenType Layout tables from
OpenType fonts with FreeType and
This is HarfBuzz, an OpenType Layout engine.
The table reading code in:
It was derived originally from the OpenType code in FreeType-1.x, ported to
FreeType2. (This code has been abandoned for FreeType2, but until something
better comes along, should serve our purposes.) In addition to porting to
FreeType-2, it has been modified in various other ways.
ftxopen.[ch]
ftxopenf.h
ftxgdef.[ch]
ftxgpos.[ch]
ftxgdef.[ch]
It also includes a partial XML dumper for OpenType Layout tables useful for
figuring out what is going on. Please extend to cover additional parts of the
tables as you encounter fonts using them. The dumper is written by Owen Taylor.
Is derived from the OpenType code in FreeType-1.x, ported to FreeType2.
(This code has been abandoned for FreeType2, but until something better
comes along, should serve our purposes.)
Bug reports on these files should be sent to the HarfBuzz mailing list as
listed on http://freedesktop.org/wiki/Software/harfbuzz
This code should be left following the FreeType indentation style and
coding conventions.
For license information, see the file COPYING.
In addition to porting to FreeType-2, it has been modified to
add support for PangoGlyphString's log_clusters, and in various
other ways. Bug reports on these files should be sent to
gtk-i18n-list@gtk.org, NOT to the freetype maintainers.
The license for these files is in the file FT-license.txt.
Most of the additional files in this directory implement a high-level
interface to this that follows Pango conventions and integrates with
Pango.
disasm.[ch] is a partial dumper for OpenType layout tables useful
in figuring out what is going on. Please extend to cover additional
parts of the tables as you encounter fonts using them.
Owen Taylor
17 December 2000
Behdad Esfahbod
April 1st, 2006
......@@ -8,15 +8,14 @@
* See ftglue.h for more information.
*/
#include <config.h>
#include "ftglue.h"
#if 0
#include <stdio.h>
#define LOG(x) ftglue_log x
#define LOG(x) _hb_ftglue_log x
static void
ftglue_log( const char* format, ... )
_hb_ftglue_log( const char* format, ... )
{
va_list ap;
......@@ -31,7 +30,7 @@ ftglue_log( const char* format, ... )
/* only used internally */
static FT_Pointer
ftglue_qalloc( FT_Memory memory,
_hb_ftglue_qalloc( FT_Memory memory,
FT_ULong size,
FT_Error *perror )
{
......@@ -50,11 +49,11 @@ ftglue_qalloc( FT_Memory memory,
}
#undef QALLOC /* just in case */
#define QALLOC(ptr,size) ( (ptr) = ftglue_qalloc( memory, (size), &error ), error != 0 )
#define QALLOC(ptr,size) ( (ptr) = _hb_ftglue_qalloc( memory, (size), &error ), error != 0 )
FTGLUE_APIDEF( FT_Pointer )
ftglue_alloc( FT_Memory memory,
_hb_ftglue_alloc( FT_Memory memory,
FT_ULong size,
FT_Error *perror )
{
......@@ -76,7 +75,7 @@ ftglue_alloc( FT_Memory memory,
FTGLUE_APIDEF( FT_Pointer )
ftglue_realloc( FT_Memory memory,
_hb_ftglue_realloc( FT_Memory memory,
FT_Pointer block,
FT_ULong old_size,
FT_ULong new_size,
......@@ -87,11 +86,11 @@ ftglue_realloc( FT_Memory memory,
if ( old_size == 0 || block == NULL )
{
block2 = ftglue_alloc( memory, new_size, &error );
block2 = _hb_ftglue_alloc( memory, new_size, &error );
}
else if ( new_size == 0 )
{
ftglue_free( memory, block );
_hb_ftglue_free( memory, block );
}
else
{
......@@ -111,7 +110,7 @@ ftglue_realloc( FT_Memory memory,
FTGLUE_APIDEF( void )
ftglue_free( FT_Memory memory,
_hb_ftglue_free( FT_Memory memory,
FT_Pointer block )
{
if ( block )
......@@ -120,7 +119,7 @@ ftglue_free( FT_Memory memory,
FTGLUE_APIDEF( FT_Long )
ftglue_stream_pos( FT_Stream stream )
_hb_ftglue_stream_pos( FT_Stream stream )
{
LOG(( "ftglue:stream:pos() -> %ld\n", stream->pos ));
return stream->pos;
......@@ -128,7 +127,7 @@ ftglue_stream_pos( FT_Stream stream )
FTGLUE_APIDEF( FT_Error )
ftglue_stream_seek( FT_Stream stream,
_hb_ftglue_stream_seek( FT_Stream stream,
FT_Long pos )
{
FT_Error error = 0;
......@@ -136,7 +135,7 @@ ftglue_stream_seek( FT_Stream stream,
stream->pos = pos;
if ( stream->read )
{
if ( stream->read( stream, pos, 0, 0 ) )
if ( stream->read( stream, pos, NULL, 0 ) )
error = FT_Err_Invalid_Stream_Operation;
}
else if ( pos > (FT_Long)stream->size )
......@@ -148,7 +147,7 @@ ftglue_stream_seek( FT_Stream stream,
FTGLUE_APIDEF( FT_Error )
ftglue_stream_frame_enter( FT_Stream stream,
_hb_ftglue_stream_frame_enter( FT_Stream stream,
FT_ULong count )
{
FT_Error error = FT_Err_Ok;
......@@ -198,7 +197,7 @@ Exit:
FTGLUE_APIDEF( void )
ftglue_stream_frame_exit( FT_Stream stream )
_hb_ftglue_stream_frame_exit( FT_Stream stream )
{
if ( stream->read )
{
......@@ -206,68 +205,21 @@ ftglue_stream_frame_exit( FT_Stream stream )
FREE( stream->base );
}
stream->cursor = 0;
stream->limit = 0;
stream->cursor = NULL;
stream->limit = NULL;
LOG(( "ftglue:stream:frame_exit()\n" ));
}
FTGLUE_APIDEF( FT_Byte )
ftglue_stream_get_byte( FT_Stream stream )
{
FT_Byte result = 0;
if ( stream->cursor < stream->limit )
result = *stream->cursor++;
return result;
}
FTGLUE_APIDEF( FT_Short )
ftglue_stream_get_short( FT_Stream stream )
{
FT_Byte* p;
FT_Short result = 0;
p = stream->cursor;
if ( p + 2 <= stream->limit )
{
result = (FT_Short)((p[0] << 8) | p[1]);
stream->cursor = p+2;
}
return result;
}
FTGLUE_APIDEF( FT_Long )
ftglue_stream_get_long( FT_Stream stream )
{
FT_Byte* p;
FT_Long result = 0;
p = stream->cursor;
if ( p + 4 <= stream->limit )
{
result = (FT_Long)(((FT_Long)p[0] << 24) |
((FT_Long)p[1] << 16) |
((FT_Long)p[2] << 8) |
p[3] );
stream->cursor = p+4;
}
return result;
}
FTGLUE_APIDEF( FT_Error )
ftglue_face_goto_table( FT_Face face,
_hb_ftglue_face_goto_table( FT_Face face,
FT_ULong the_tag,
FT_Stream stream )
{
FT_Error error;
LOG(( "ftglue_face_goto_table( %p, %c%c%c%c, %p )\n",
LOG(( "_hb_ftglue_face_goto_table( %p, %c%c%c%c, %p )\n",
face,
(int)((the_tag >> 24) & 0xFF),
(int)((the_tag >> 16) & 0xFF),
......@@ -331,11 +283,11 @@ ftglue_face_goto_table( FT_Face face,
if ( tag == the_tag )
{
LOG(( "TrueType table (start: %ld) (size: %ld)\n", start, size ));
error = ftglue_stream_seek( stream, offset+start );
error = _hb_ftglue_stream_seek( stream, offset+start );
goto FoundIt;
}
}
error = TT_Err_Table_Missing;
error = FT_Err_Table_Missing;
FoundIt:
FORGET_Frame();
......
/* ftglue.c: Glue code for compiling the OpenType code from
/* ftglue.h: Glue code for compiling the OpenType code from
* FreeType 1 using only the public API of FreeType 2
*
* By David Turner, The FreeType Project (www.freetype.org)
......@@ -40,8 +40,8 @@
*
* PS: This "glue" code is explicitely put in the public domain
*/
#ifndef __OPENTYPE_FTGLUE_H__
#define __OPENTYPE_FTGLUE_H__
#ifndef FTGLUE_H
#define FTGLUE_H
#include <ft2build.h>
#include FT_FREETYPE_H
......@@ -50,10 +50,6 @@ FT_BEGIN_HEADER
/* utility macros */
#define TT_Err_Ok FT_Err_Ok
#define TT_Err_Invalid_Argument FT_Err_Invalid_Argument
#define TT_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle
#define TT_Err_Table_Missing FT_Err_Table_Missing
#define SET_ERR(c) ( (error = (c)) != 0 )
......@@ -66,14 +62,23 @@ FT_BEGIN_HEADER
#endif
/* stream macros used by the OpenType parser */
#define FILE_Pos() ftglue_stream_pos( stream )
#define FILE_Seek(pos) SET_ERR( ftglue_stream_seek( stream, pos ) )
#define ACCESS_Frame(size) SET_ERR( ftglue_stream_frame_enter( stream, size ) )
#define FORGET_Frame() ftglue_stream_frame_exit( stream )
#define FILE_Pos() _hb_ftglue_stream_pos( stream )
#define FILE_Seek(pos) SET_ERR( _hb_ftglue_stream_seek( stream, pos ) )
#define ACCESS_Frame(size) SET_ERR( _hb_ftglue_stream_frame_enter( stream, size ) )
#define FORGET_Frame() _hb_ftglue_stream_frame_exit( stream )
#define GET_Byte() (*stream->cursor++)
#define GET_Short() (stream->cursor += 2, (FT_Short)( \
(*(((FT_Byte*)stream->cursor)-2) << 8) | \
*(((FT_Byte*)stream->cursor)-1) \
))
#define GET_Long() (stream->cursor += 4, (FT_Long)( \
(*(((FT_Byte*)stream->cursor)-4) << 24) | \
(*(((FT_Byte*)stream->cursor)-3) << 16) | \
(*(((FT_Byte*)stream->cursor)-2) << 8) | \
*(((FT_Byte*)stream->cursor)-1) \
))
#define GET_Byte() ftglue_stream_get_byte( stream )
#define GET_Short() ftglue_stream_get_short( stream )
#define GET_Long() ftglue_stream_get_long( stream )
#define GET_Char() ((FT_Char)GET_Byte())
#define GET_UShort() ((FT_UShort)GET_Short())
......@@ -81,45 +86,36 @@ FT_BEGIN_HEADER
#define GET_Tag4() GET_ULong()
FTGLUE_API( FT_Long )
ftglue_stream_pos( FT_Stream stream );
_hb_ftglue_stream_pos( FT_Stream stream );
FTGLUE_API( FT_Error )
ftglue_stream_seek( FT_Stream stream,
_hb_ftglue_stream_seek( FT_Stream stream,
FT_Long pos );
FTGLUE_API( FT_Error )
ftglue_stream_frame_enter( FT_Stream stream,
_hb_ftglue_stream_frame_enter( FT_Stream stream,
FT_ULong size );
FTGLUE_API( void )
ftglue_stream_frame_exit( FT_Stream stream );
FTGLUE_API( FT_Byte )
ftglue_stream_get_byte( FT_Stream stream );
FTGLUE_API( FT_Short )
ftglue_stream_get_short( FT_Stream stream );
FTGLUE_API( FT_Long )
ftglue_stream_get_long( FT_Stream stream );
_hb_ftglue_stream_frame_exit( FT_Stream stream );
FTGLUE_API( FT_Error )
ftglue_face_goto_table( FT_Face face,
_hb_ftglue_face_goto_table( FT_Face face,
FT_ULong tag,
FT_Stream stream );
/* memory macros used by the OpenType parser */
#define ALLOC(_ptr,_size) \
( (_ptr) = ftglue_alloc( memory, _size, &error ), error != 0 )
( (_ptr) = _hb_ftglue_alloc( memory, _size, &error ), error != 0 )
#define REALLOC(_ptr,_oldsz,_newsz) \
( (_ptr) = ftglue_realloc( memory, (_ptr), (_oldsz), (_newsz), &error ), error != 0 )
( (_ptr) = _hb_ftglue_realloc( memory, (_ptr), (_oldsz), (_newsz), &error ), error != 0 )
#define FREE(_ptr) \
do { \
if ( (_ptr) ) \
{ \
ftglue_free( memory, _ptr ); \
_hb_ftglue_free( memory, _ptr ); \
_ptr = NULL; \
} \
} while (0)
......@@ -134,23 +130,21 @@ ftglue_face_goto_table( FT_Face face,
FTGLUE_API( FT_Pointer )
ftglue_alloc( FT_Memory memory,
_hb_ftglue_alloc( FT_Memory memory,
FT_ULong size,
FT_Error *perror_ );
FTGLUE_API( FT_Pointer )
ftglue_realloc( FT_Memory memory,
_hb_ftglue_realloc( FT_Memory memory,
FT_Pointer block,
FT_ULong old_size,
FT_ULong new_size,
FT_Error *perror_ );
FTGLUE_API( void )
ftglue_free( FT_Memory memory,
_hb_ftglue_free( FT_Memory memory,
FT_Pointer block );
/* */
FT_END_HEADER
#endif /* __OPENTYPE_FTGLUE_H__ */
#endif /* FTGLUE_H */
此差异已折叠。
/*******************************************************************
*
* ftxgdef.h
*
* TrueType Open GDEF table support
*
* Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
******************************************************************/
#ifndef FTXOPEN_H
#error "Don't include this file! Use ftxopen.h instead."
#endif
#ifndef FTXGDEF_H
#define FTXGDEF_H
#ifdef __cplusplus
extern "C" {
#endif
#define TTO_Err_Invalid_GDEF_SubTable_Format 0x1030
#define TTO_Err_Invalid_GDEF_SubTable 0x1031
/* GDEF glyph classes */
#define UNCLASSIFIED_GLYPH 0
#define SIMPLE_GLYPH 1
#define LIGATURE_GLYPH 2
#define MARK_GLYPH 3
#define COMPONENT_GLYPH 4
/* GDEF glyph properties, corresponding to class values 1-4. Note that
TTO_COMPONENT has no corresponding flag in the LookupFlag field. */
#define TTO_BASE_GLYPH 0x0002
#define TTO_LIGATURE 0x0004
#define TTO_MARK 0x0008
#define TTO_COMPONENT 0x0010
/* Attachment related structures */
struct TTO_AttachPoint_
{
FT_UShort PointCount; /* size of the PointIndex array */
FT_UShort* PointIndex; /* array of contour points */
};
typedef struct TTO_AttachPoint_ TTO_AttachPoint;
struct TTO_AttachList_
{
FT_Bool loaded;
TTO_Coverage Coverage; /* Coverage table */
FT_UShort GlyphCount; /* number of glyphs with
attachments */
TTO_AttachPoint* AttachPoint; /* array of AttachPoint tables */
};
typedef struct TTO_AttachList_ TTO_AttachList;
/* Ligature Caret related structures */
struct TTO_CaretValueFormat1_
{
FT_Short Coordinate; /* x or y value (in design units) */
};
typedef struct TTO_CaretValueFormat1_ TTO_CaretValueFormat1;
struct TTO_CaretValueFormat2_
{
FT_UShort CaretValuePoint; /* contour point index on glyph */
};
typedef struct TTO_CaretValueFormat2_ TTO_CaretValueFormat2;
struct TTO_CaretValueFormat3_
{
FT_Short Coordinate; /* x or y value (in design units) */
TTO_Device Device; /* Device table for x or y value */
};
typedef struct TTO_CaretValueFormat3_ TTO_CaretValueFormat3;
struct TTO_CaretValueFormat4_
{
FT_UShort IdCaretValue; /* metric ID */
};
typedef struct TTO_CaretValueFormat4_ TTO_CaretValueFormat4;
struct TTO_CaretValue_
{
FT_UShort CaretValueFormat; /* 1, 2, 3, or 4 */
union
{
TTO_CaretValueFormat1 cvf1;
TTO_CaretValueFormat2 cvf2;
TTO_CaretValueFormat3 cvf3;
TTO_CaretValueFormat4 cvf4;
} cvf;
};
typedef struct TTO_CaretValue_ TTO_CaretValue;
struct TTO_LigGlyph_
{
FT_Bool loaded;
FT_UShort CaretCount; /* number of caret values */
TTO_CaretValue* CaretValue; /* array of caret values */
};
typedef struct TTO_LigGlyph_ TTO_LigGlyph;
struct TTO_LigCaretList_
{
FT_Bool loaded;
TTO_Coverage Coverage; /* Coverage table */
FT_UShort LigGlyphCount; /* number of ligature glyphs */
TTO_LigGlyph* LigGlyph; /* array of LigGlyph tables */
};
typedef struct TTO_LigCaretList_ TTO_LigCaretList;
/* The `NewGlyphClasses' field is not defined in the TTO specification.
We use it for fonts with a constructed `GlyphClassDef' structure
(i.e., which don't have a GDEF table) to collect glyph classes
assigned during the lookup process. The number of arrays in this
pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth
array then contains the glyph class values of the glyphs not covered
by the ClassRangeRecords structures with index n-1 and n. We store
glyph class values for four glyphs in a single array element.
`LastGlyph' is identical to the number of glyphs minus one in the
font; we need it only if `NewGlyphClasses' is not NULL (to have an
upper bound for the last array).
Note that we first store the file offset to the `MarkAttachClassDef'
field (which has been introduced in OpenType 1.2) -- since the
`Version' field value hasn't been increased to indicate that we have
one more field for some obscure reason, we must parse the GSUB table
to find out whether class values refer to this table. Only then we
can finally load the MarkAttachClassDef structure if necessary. */
struct TTO_GDEFHeader_
{
FT_Memory memory;
FT_ULong offset;
FT_Fixed Version;
TTO_ClassDefinition GlyphClassDef;
TTO_AttachList AttachList;
TTO_LigCaretList LigCaretList;
FT_ULong MarkAttachClassDef_offset;
TTO_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */
FT_UShort LastGlyph;
FT_UShort** NewGlyphClasses;
};
typedef struct TTO_GDEFHeader_ TTO_GDEFHeader;
typedef struct TTO_GDEFHeader_* TTO_GDEF;
/* finally, the GDEF API */
/* EXPORT_DEF
FT_Error TT_Init_GDEF_Extension( TT_Engine engine ); */
EXPORT_FUNC
FT_Error TT_New_GDEF_Table( FT_Face face,
TTO_GDEFHeader** retptr );
EXPORT_DEF
FT_Error TT_Load_GDEF_Table( FT_Face face,
TTO_GDEFHeader** gdef );
EXPORT_DEF
FT_Error TT_Done_GDEF_Table ( TTO_GDEFHeader* gdef );
EXPORT_DEF
FT_Error TT_GDEF_Get_Glyph_Property( TTO_GDEFHeader* gdef,
FT_UShort glyphID,
FT_UShort* property );
EXPORT_DEF
FT_Error TT_GDEF_Build_ClassDefinition( TTO_GDEFHeader* gdef,
FT_UShort num_glyphs,
FT_UShort glyph_count,
FT_UShort* glyph_array,
FT_UShort* class_array );
#ifdef __cplusplus
}
#endif
#endif /* FTXGDEF_H */
/* END */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*******************************************************************
*
* ftxopen.h
*
* TrueType Open support.
*
* Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
* This file should be included by the application. Nevertheless,
* the table specific APIs (and structures) are located in files like
* ftxgsub.h or ftxgpos.h; these header files are read by ftxopen.h .
*
******************************************************************/
#ifndef FTXOPEN_H
#define FTXOPEN_H
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef __cplusplus
extern "C" {
#endif
#define EXPORT_DEF
#define EXPORT_FUNC
#define TTO_MAX_NESTING_LEVEL 100
#define TTO_Err_Invalid_SubTable_Format 0x1000
#define TTO_Err_Invalid_SubTable 0x1001
#define TTO_Err_Not_Covered 0x1002
#define TTO_Err_Too_Many_Nested_Contexts 0x1003
#define TTO_Err_No_MM_Interpreter 0x1004
#define TTO_Err_Empty_Script 0x1005
/* Script list related structures */
struct TTO_LangSys_
{
FT_UShort LookupOrderOffset; /* always 0 for TT Open 1.0 */
FT_UShort ReqFeatureIndex; /* required FeatureIndex */
FT_UShort FeatureCount; /* number of Feature indices */
FT_UShort* FeatureIndex; /* array of Feature indices */
};
typedef struct TTO_LangSys_ TTO_LangSys;
struct TTO_LangSysRecord_
{
FT_ULong LangSysTag; /* LangSysTag identifier */
TTO_LangSys LangSys; /* LangSys table */
};
typedef struct TTO_LangSysRecord_ TTO_LangSysRecord;
struct TTO_Script_
{
TTO_LangSys DefaultLangSys; /* DefaultLangSys table */
FT_UShort LangSysCount; /* number of LangSysRecords */
TTO_LangSysRecord* LangSysRecord; /* array of LangSysRecords */
};
typedef struct TTO_Script_ TTO_Script;
struct TTO_ScriptRecord_
{
FT_ULong ScriptTag; /* ScriptTag identifier */
TTO_Script Script; /* Script table */
};
typedef struct TTO_ScriptRecord_ TTO_ScriptRecord;
struct TTO_ScriptList_
{
FT_UShort ScriptCount; /* number of ScriptRecords */
TTO_ScriptRecord* ScriptRecord; /* array of ScriptRecords */
};
typedef struct TTO_ScriptList_ TTO_ScriptList;
/* Feature list related structures */
struct TTO_Feature_
{
FT_UShort FeatureParams; /* always 0 for TT Open 1.0 */
FT_UShort LookupListCount; /* number of LookupList indices */
FT_UShort* LookupListIndex; /* array of LookupList indices */
};
typedef struct TTO_Feature_ TTO_Feature;
struct TTO_FeatureRecord_
{
FT_ULong FeatureTag; /* FeatureTag identifier */
TTO_Feature Feature; /* Feature table */
};
typedef struct TTO_FeatureRecord_ TTO_FeatureRecord;
struct TTO_FeatureList_
{
FT_UShort FeatureCount; /* number of FeatureRecords */
TTO_FeatureRecord* FeatureRecord; /* array of FeatureRecords */
FT_UShort* ApplyOrder; /* order to apply features */
FT_UShort ApplyCount; /* number of elements in ApplyOrder */
};
typedef struct TTO_FeatureList_ TTO_FeatureList;
/* Lookup list related structures */
struct TTO_SubTable_; /* defined below after inclusion
of ftxgsub.h and ftxgpos.h */
typedef struct TTO_SubTable_ TTO_SubTable;
struct TTO_Lookup_
{
FT_UShort LookupType; /* Lookup type */
FT_UShort LookupFlag; /* Lookup qualifiers */
FT_UShort SubTableCount; /* number of SubTables */
TTO_SubTable* SubTable; /* array of SubTables */
};
typedef struct TTO_Lookup_ TTO_Lookup;
/* The `Properties' field is not defined in the TTO specification but
is needed for processing lookups. If properties[n] is > 0, the
functions TT_GSUB_Apply_String() resp. TT_GPOS_Apply_String() will
process Lookup[n] for glyphs which have the specific bit not set in
the `properties' field of the input string object. */
struct TTO_LookupList_
{
FT_UShort LookupCount; /* number of Lookups */
TTO_Lookup* Lookup; /* array of Lookup records */
FT_UInt* Properties; /* array of flags */
};
typedef struct TTO_LookupList_ TTO_LookupList;
/* Possible LookupFlag bit masks. `IGNORE_SPECIAL_MARKS' comes from the
OpenType 1.2 specification; RIGHT_TO_LEFT has been (re)introduced in
OpenType 1.3 -- if set, the last glyph in a cursive attachment
sequence has to be positioned on the baseline -- regardless of the
writing direction. */
#define RIGHT_TO_LEFT 0x0001
#define IGNORE_BASE_GLYPHS 0x0002
#define IGNORE_LIGATURES 0x0004
#define IGNORE_MARKS 0x0008
#define IGNORE_SPECIAL_MARKS 0xFF00
struct TTO_CoverageFormat1_
{
FT_UShort GlyphCount; /* number of glyphs in GlyphArray */
FT_UShort* GlyphArray; /* array of glyph IDs */
};
typedef struct TTO_CoverageFormat1_ TTO_CoverageFormat1;
struct TTO_RangeRecord_
{
FT_UShort Start; /* first glyph ID in the range */
FT_UShort End; /* last glyph ID in the range */
FT_UShort StartCoverageIndex; /* coverage index of first
glyph ID in the range */
};
typedef struct TTO_RangeRecord_ TTO_RangeRecord;
struct TTO_CoverageFormat2_
{
FT_UShort RangeCount; /* number of RangeRecords */
TTO_RangeRecord* RangeRecord; /* array of RangeRecords */
};
typedef struct TTO_CoverageFormat2_ TTO_CoverageFormat2;
struct TTO_Coverage_
{
FT_UShort CoverageFormat; /* 1 or 2 */
union
{
TTO_CoverageFormat1 cf1;
TTO_CoverageFormat2 cf2;
} cf;
};
typedef struct TTO_Coverage_ TTO_Coverage;
struct TTO_ClassDefFormat1_
{
FT_UShort StartGlyph; /* first glyph ID of the
ClassValueArray */
FT_UShort GlyphCount; /* size of the ClassValueArray */
FT_UShort* ClassValueArray; /* array of class values */
};
typedef struct TTO_ClassDefFormat1_ TTO_ClassDefFormat1;
struct TTO_ClassRangeRecord_
{
FT_UShort Start; /* first glyph ID in the range */
FT_UShort End; /* last glyph ID in the range */
FT_UShort Class; /* applied to all glyphs in range */
};
typedef struct TTO_ClassRangeRecord_ TTO_ClassRangeRecord;
struct TTO_ClassDefFormat2_
{
FT_UShort ClassRangeCount;
/* number of ClassRangeRecords */
TTO_ClassRangeRecord* ClassRangeRecord;
/* array of ClassRangeRecords */
};
typedef struct TTO_ClassDefFormat2_ TTO_ClassDefFormat2;
/* The `Defined' field is not defined in the TTO specification but
apparently needed for processing fonts like trado.ttf: This font
refers to a class which contains not a single element. We map such
classes to class 0. */
struct TTO_ClassDefinition_
{
FT_Bool loaded;
FT_Bool* Defined; /* array of Booleans.
If Defined[n] is FALSE,
class n contains no glyphs. */
FT_UShort ClassFormat; /* 1 or 2 */
union
{
TTO_ClassDefFormat1 cd1;
TTO_ClassDefFormat2 cd2;
} cd;
};
typedef struct TTO_ClassDefinition_ TTO_ClassDefinition;
struct TTO_Device_
{
FT_UShort StartSize; /* smallest size to correct */
FT_UShort EndSize; /* largest size to correct */
FT_UShort DeltaFormat; /* DeltaValue array data format:
1, 2, or 3 */
FT_UShort* DeltaValue; /* array of compressed data */
};
typedef struct TTO_Device_ TTO_Device;
#include "otlbuffer.h"
#include "ftxgdef.h"
#include "ftxgsub.h"
#include "ftxgpos.h"
struct TTO_SubTable_
{
union
{
TTO_GSUB_SubTable gsub;
TTO_GPOS_SubTable gpos;
} st;
};
enum TTO_Type_
{
GSUB,
GPOS
};
typedef enum TTO_Type_ TTO_Type;
#ifdef __cplusplus
}
#endif
#endif /* FTXOPEN_H */
/* END */
/*******************************************************************
*
* ftxopenf.h
*
* internal TrueType Open functions
*
* Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
******************************************************************/
#ifndef FTXOPENF_H
#define FTXOPENF_H
#include "ftxopen.h"
#ifdef __cplusplus
extern "C" {
#endif
/* functions from ftxopen.c */
FT_Error Load_ScriptList( TTO_ScriptList* sl,
FT_Stream stream );
FT_Error Load_FeatureList( TTO_FeatureList* fl,
FT_Stream input );
FT_Error Load_LookupList( TTO_LookupList* ll,
FT_Stream input,
TTO_Type type );
FT_Error Load_Coverage( TTO_Coverage* c,
FT_Stream input );
FT_Error Load_ClassDefinition( TTO_ClassDefinition* cd,
FT_UShort limit,
FT_Stream input );
FT_Error Load_EmptyClassDefinition( TTO_ClassDefinition* cd,
FT_Stream input );
FT_Error Load_Device( TTO_Device* d,
FT_Stream input );
void Free_ScriptList( TTO_ScriptList* sl,
FT_Memory memory );
void Free_FeatureList( TTO_FeatureList* fl,
FT_Memory memory );
void Free_LookupList( TTO_LookupList* ll,
TTO_Type type,
FT_Memory memory );
void Free_Coverage( TTO_Coverage* c,
FT_Memory memory );
void Free_ClassDefinition( TTO_ClassDefinition* cd,
FT_Memory memory );
void Free_Device( TTO_Device* d,
FT_Memory memory );
/* functions from ftxgsub.c */
FT_Error Load_SingleSubst( TTO_SingleSubst* ss,
FT_Stream input );
FT_Error Load_MultipleSubst( TTO_MultipleSubst* ms,
FT_Stream input );
FT_Error Load_AlternateSubst( TTO_AlternateSubst* as,
FT_Stream input );
FT_Error Load_LigatureSubst( TTO_LigatureSubst* ls,
FT_Stream input );
FT_Error Load_ContextSubst( TTO_ContextSubst* cs,
FT_Stream input );
FT_Error Load_ChainContextSubst( TTO_ChainContextSubst* ccs,
FT_Stream input );
FT_Error Load_ReverseChainContextSubst( TTO_ReverseChainContextSubst* rccs,
FT_Stream input );
void Free_SingleSubst( TTO_SingleSubst* ss,
FT_Memory memory );
void Free_MultipleSubst( TTO_MultipleSubst* ms,
FT_Memory memory );
void Free_AlternateSubst( TTO_AlternateSubst* as,
FT_Memory memory );
void Free_LigatureSubst( TTO_LigatureSubst* ls,
FT_Memory memory );
void Free_ContextSubst( TTO_ContextSubst* cs,
FT_Memory memory );
void Free_ChainContextSubst( TTO_ChainContextSubst* ccs,
FT_Memory memory );
void Free_ReverseChainContextSubst( TTO_ReverseChainContextSubst* rccs,
FT_Memory memory );
/* functions from ftxgpos.c */
FT_Error Load_SinglePos( TTO_SinglePos* sp,
FT_Stream input );
FT_Error Load_PairPos( TTO_PairPos* pp,
FT_Stream input );
FT_Error Load_CursivePos( TTO_CursivePos* cp,
FT_Stream input );
FT_Error Load_MarkBasePos( TTO_MarkBasePos* mbp,
FT_Stream input );
FT_Error Load_MarkLigPos( TTO_MarkLigPos* mlp,
FT_Stream input );
FT_Error Load_MarkMarkPos( TTO_MarkMarkPos* mmp,
FT_Stream input );
FT_Error Load_ContextPos( TTO_ContextPos* cp,
FT_Stream input );
FT_Error Load_ChainContextPos( TTO_ChainContextPos* ccp,
FT_Stream input );
void Free_SinglePos( TTO_SinglePos* sp,
FT_Memory memory );
void Free_PairPos( TTO_PairPos* pp,
FT_Memory memory );
void Free_CursivePos( TTO_CursivePos* cp,
FT_Memory memory );
void Free_MarkBasePos( TTO_MarkBasePos* mbp,
FT_Memory memory );
void Free_MarkLigPos( TTO_MarkLigPos* mlp,
FT_Memory memory );
void Free_MarkMarkPos( TTO_MarkMarkPos* mmp,
FT_Memory memory );
void Free_ContextPos( TTO_ContextPos* cp,
FT_Memory memory );
void Free_ChainContextPos( TTO_ChainContextPos* ccp,
FT_Memory memory );
/* query functions */
FT_Error Coverage_Index( TTO_Coverage* c,
FT_UShort glyphID,
FT_UShort* index );
FT_Error Get_Class( TTO_ClassDefinition* cd,
FT_UShort glyphID,
FT_UShort* class,
FT_UShort* index );
FT_Error Get_Device( TTO_Device* d,
FT_UShort size,
FT_Short* value );
/* functions from ftxgdef.c */
FT_Error Add_Glyph_Property( TTO_GDEFHeader* gdef,
FT_UShort glyphID,
FT_UShort property );
FT_Error Check_Property( TTO_GDEFHeader* gdef,
OTL_GlyphItem item,
FT_UShort flags,
FT_UShort* property );
#define CHECK_Property( gdef, index, flags, property ) \
( ( error = Check_Property( (gdef), (index), (flags), \
(property) ) ) != TT_Err_Ok )
#ifdef __cplusplus
}
#endif
#endif /* FTXOPENF_H */
/* END */
/* harfbuzz-buffer.c: Buffer of glyphs for substitution/positioning
*
* Copyright 2004 Red Hat Software
*
* Portions Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*/
#include "harfbuzz-impl.h"
#include "harfbuzz-buffer.h"
#include "harfbuzz-gsub-private.h"
#include "harfbuzz-gpos-private.h"
static FT_Error
hb_buffer_ensure( HB_Buffer buffer,
FT_ULong size )
{
FT_Memory memory = buffer->memory;
FT_ULong new_allocated = buffer->allocated;
if (size > new_allocated)
{
FT_Error error;
while (size > new_allocated)
new_allocated += (new_allocated >> 1) + 8;
if ( REALLOC_ARRAY( buffer->in_string, buffer->allocated, new_allocated, HB_GlyphItemRec ) )
return error;
if ( REALLOC_ARRAY( buffer->out_string, buffer->allocated, new_allocated, HB_GlyphItemRec ) )
return error;
if ( REALLOC_ARRAY( buffer->positions, buffer->allocated, new_allocated, HB_PositionRec ) )
return error;
buffer->allocated = new_allocated;
}
return FT_Err_Ok;
}
FT_Error
hb_buffer_new( FT_Memory memory,
HB_Buffer *buffer )
{
FT_Error error;
if ( ALLOC( *buffer, sizeof( HB_BufferRec ) ) )
return error;
(*buffer)->memory = memory;
(*buffer)->in_length = 0;
(*buffer)->out_length = 0;
(*buffer)->allocated = 0;
(*buffer)->in_pos = 0;
(*buffer)->out_pos = 0;
(*buffer)->in_string = NULL;
(*buffer)->out_string = NULL;
(*buffer)->positions = NULL;
(*buffer)->max_ligID = 0;
return FT_Err_Ok;
}
FT_Error
hb_buffer_swap( HB_Buffer buffer )
{
HB_GlyphItem tmp_string;
tmp_string = buffer->in_string;
buffer->in_string = buffer->out_string;
buffer->out_string = tmp_string;
buffer->in_length = buffer->out_length;
buffer->out_length = 0;
buffer->in_pos = 0;
buffer->out_pos = 0;
return FT_Err_Ok;
}
FT_Error
hb_buffer_free( HB_Buffer buffer )
{
FT_Memory memory = buffer->memory;
FREE( buffer->in_string );
FREE( buffer->out_string );
FREE( buffer->positions );
FREE( buffer );
return FT_Err_Ok;
}
FT_Error
hb_buffer_clear( HB_Buffer buffer )
{
buffer->in_length = 0;
buffer->out_length = 0;
buffer->in_pos = 0;
buffer->out_pos = 0;
return FT_Err_Ok;
}
FT_Error
hb_buffer_add_glyph( HB_Buffer buffer,
FT_UInt glyph_index,
FT_UInt properties,
FT_UInt cluster )
{
FT_Error error;
HB_GlyphItem glyph;
error = hb_buffer_ensure( buffer, buffer->in_length + 1 );
if ( error )
return error;
glyph = &buffer->in_string[buffer->in_length];
glyph->gindex = glyph_index;
glyph->properties = properties;
glyph->cluster = cluster;
glyph->component = 0;
glyph->ligID = 0;
glyph->gproperties = HB_GLYPH_PROPERTIES_UNKNOWN;
buffer->in_length++;
return FT_Err_Ok;
}
/* The following function copies `num_out' elements from `glyph_data'
to `buffer->out_string', advancing the in array pointer in the structure
by `num_in' elements, and the out array pointer by `num_out' elements.
Finally, it sets the `length' field of `out' equal to
`pos' of the `out' structure.
If `component' is 0xFFFF, the component value from buffer->in_pos
will copied `num_out' times, otherwise `component' itself will
be used to fill the `component' fields.
If `ligID' is 0xFFFF, the ligID value from buffer->in_pos
will copied `num_out' times, otherwise `ligID' itself will
be used to fill the `ligID' fields.
The properties for all replacement glyphs are taken
from the glyph at position `buffer->in_pos'.
The cluster value for the glyph at position buffer->in_pos is used
for all replacement glyphs */
FT_Error
hb_buffer_add_output_glyphs( HB_Buffer buffer,
FT_UShort num_in,
FT_UShort num_out,
FT_UShort *glyph_data,
FT_UShort component,
FT_UShort ligID )
{
FT_Error error;
FT_UShort i;
FT_UInt properties;
FT_UInt cluster;
error = hb_buffer_ensure( buffer, buffer->out_pos + num_out );
if ( error )
return error;
properties = buffer->in_string[buffer->in_pos].properties;
cluster = buffer->in_string[buffer->in_pos].cluster;
if ( component == 0xFFFF )
component = buffer->in_string[buffer->in_pos].component;
if ( ligID == 0xFFFF )
ligID = buffer->in_string[buffer->in_pos].ligID;
for ( i = 0; i < num_out; i++ )
{
HB_GlyphItem item = &buffer->out_string[buffer->out_pos + i];
item->gindex = glyph_data[i];
item->properties = properties;
item->cluster = cluster;
item->component = component;
item->ligID = ligID;
item->gproperties = HB_GLYPH_PROPERTIES_UNKNOWN;
}
buffer->in_pos += num_in;
buffer->out_pos += num_out;
buffer->out_length = buffer->out_pos;
return FT_Err_Ok;
}
FT_Error
hb_buffer_add_output_glyph( HB_Buffer buffer,
FT_UInt glyph_index,
FT_UShort component,
FT_UShort ligID )
{
FT_UShort glyph_data = glyph_index;
return hb_buffer_add_output_glyphs ( buffer, 1, 1,
&glyph_data, component, ligID );
}
FT_Error
hb_buffer_copy_output_glyph ( HB_Buffer buffer )
{
FT_Error error;
error = hb_buffer_ensure( buffer, buffer->out_pos + 1 );
if ( error )
return error;
buffer->out_string[buffer->out_pos++] = buffer->in_string[buffer->in_pos++];
buffer->out_length = buffer->out_pos;
return FT_Err_Ok;
}
FT_UShort
hb_buffer_allocate_ligid( HB_Buffer buffer )
{
return buffer->max_ligID++;
}
/* harfbuzz-buffer.h: Buffer of glyphs for substitution/positioning
*
* Copyrigh 2004 Red Hat Software
*
* Portions Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*/
#ifndef HARFBUZZ_BUFFER_H
#define HARFBUZZ_BUFFER_H
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
#define HB_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
typedef struct HB_GlyphItemRec_ {
FT_UInt gindex;
FT_UInt properties;
FT_UInt cluster;
FT_UShort component;
FT_UShort ligID;
FT_UShort gproperties;
} HB_GlyphItemRec, *HB_GlyphItem;
typedef struct HB_PositionRec_ {
FT_Pos x_pos;
FT_Pos y_pos;
FT_Pos x_advance;
FT_Pos y_advance;
FT_UShort back; /* number of glyphs to go back
for drawing current glyph */
FT_Bool new_advance; /* if set, the advance width values are
absolute, i.e., they won't be
added to the original glyph's value
but rather replace them. */
FT_Short cursive_chain; /* character to which this connects,
may be positive or negative; used
only internally */
} HB_PositionRec, *HB_Position;
typedef struct HB_BufferRec_{
FT_Memory memory;
FT_ULong allocated;
FT_ULong in_length;
FT_ULong out_length;
FT_ULong in_pos;
FT_ULong out_pos;
HB_GlyphItem in_string;
HB_GlyphItem out_string;
HB_Position positions;
FT_UShort max_ligID;
} HB_BufferRec, *HB_Buffer;
FT_Error
hb_buffer_new( FT_Memory memory,
HB_Buffer *buffer );
FT_Error
hb_buffer_swap( HB_Buffer buffer );
FT_Error
hb_buffer_free( HB_Buffer buffer );
FT_Error
hb_buffer_clear( HB_Buffer buffer );
FT_Error
hb_buffer_add_glyph( HB_Buffer buffer,
FT_UInt glyph_index,
FT_UInt properties,
FT_UInt cluster );
FT_Error
hb_buffer_add_output_glyphs( HB_Buffer buffer,
FT_UShort num_in,
FT_UShort num_out,
FT_UShort *glyph_data,
FT_UShort component,
FT_UShort ligID );
FT_Error
hb_buffer_add_output_glyph ( HB_Buffer buffer,
FT_UInt glyph_index,
FT_UShort component,
FT_UShort ligID );
FT_Error
hb_buffer_copy_output_glyph ( HB_Buffer buffer );
FT_UShort
hb_buffer_allocate_ligid( HB_Buffer buffer );
FT_END_HEADER
#endif /* HARFBUZZ_BUFFER_H */
/* Pango
* otttest.c: Test program for OpenType
/* harfbuzz-dump-main.c: Test program for OpenType
*
* Copyright (C) 2000 Red Hat Software
*
......@@ -19,13 +18,12 @@
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include "ftxopen.h"
#include "harfbuzz-open.h"
#include "disasm.h"
#include "harfbuzz-dump.h"
#define N_ELEMENTS(arr) (sizeof(arr)/ sizeof((arr)[0]))
......@@ -56,7 +54,7 @@ print_tag (FT_ULong tag)
}
static void
maybe_add_feature (TTO_GSUB gsub,
maybe_add_feature (HB_GSUB gsub,
FT_UShort script_index,
FT_ULong tag,
FT_UShort property)
......@@ -65,22 +63,22 @@ maybe_add_feature (TTO_GSUB gsub,
FT_UShort feature_index;
/* 0xffff == default language system */
error = TT_GSUB_Select_Feature (gsub, tag, script_index, 0xffff, &feature_index);
error = HB_GSUB_Select_Feature (gsub, tag, script_index, 0xffff, &feature_index);
if (error)
{
if (error == TTO_Err_Not_Covered)
if (error == HB_Err_Not_Covered)
{
print_tag (tag);
fprintf (stderr, " not covered, ignored\n");
return;
}
croak ("TT_GSUB_Select_Feature", error);
croak ("HB_GSUB_Select_Feature", error);
}
if ((error = TT_GSUB_Add_Feature (gsub, feature_index, property)))
croak ("TT_GSUB_Add_Feature", error);
if ((error = HB_GSUB_Add_Feature (gsub, feature_index, property)))
croak ("HB_GSUB_Add_Feature", error);
}
static void
......@@ -122,23 +120,23 @@ select_cmap (FT_Face face)
}
static void
add_features (TTO_GSUB gsub)
add_features (HB_GSUB gsub)
{
FT_Error error;
FT_ULong tag = FT_MAKE_TAG ('a', 'r', 'a', 'b');
FT_UShort script_index;
error = TT_GSUB_Select_Script (gsub, tag, &script_index);
error = HB_GSUB_Select_Script (gsub, tag, &script_index);
if (error)
{
if (error == TTO_Err_Not_Covered)
if (error == HB_Err_Not_Covered)
{
fprintf (stderr, "Arabic not covered, no features used\n");
return;
}
croak ("TT_GSUB_Select_Script", error);
croak ("HB_GSUB_Select_Script", error);
}
maybe_add_feature (gsub, script_index, FT_MAKE_TAG ('i', 'n', 'i', 't'), I);
......@@ -150,7 +148,7 @@ add_features (TTO_GSUB gsub)
#if 0
void
dump_string (TTO_GSUB_String *str)
dump_string (HB_GSUB_String *str)
{
FT_ULong i;
......@@ -173,20 +171,20 @@ FT_UShort arabic_props[] = { I|L, M|L, M|L, M|L, M|L, F|L, I|L, M|L
void
try_string (FT_Library library,
FT_Face face,
TTO_GSUB gsub)
HB_GSUB gsub)
{
FT_Error error;
TTO_GSUB_String *in_str;
TTO_GSUB_String *out_str;
HB_GSUB_String *in_str;
HB_GSUB_String *out_str;
FT_ULong i;
if ((error = TT_GSUB_String_New (face->memory, &in_str)))
croak ("TT_GSUB_String_New", error);
if ((error = TT_GSUB_String_New (face->memory, &out_str)))
croak ("TT_GSUB_String_New", error);
if ((error = HB_GSUB_String_New (face->memory, &in_str)))
croak ("HB_GSUB_String_New", error);
if ((error = HB_GSUB_String_New (face->memory, &out_str)))
croak ("HB_GSUB_String_New", error);
if ((error = TT_GSUB_String_Set_Length (in_str, N_ELEMENTS (arabic_str))))
croak ("TT_GSUB_String_Set_Length", error);
if ((error = HB_GSUB_String_Set_Length (in_str, N_ELEMENTS (arabic_str))))
croak ("HB_GSUB_String_Set_Length", error);
for (i=0; i < N_ELEMENTS (arabic_str); i++)
{
......@@ -196,16 +194,16 @@ try_string (FT_Library library,
in_str->ligIDs[i] = i;
}
if ((error = TT_GSUB_Apply_String (gsub, in_str, out_str)))
croak ("TT_GSUB_Apply_String", error);
if ((error = HB_GSUB_Apply_String (gsub, in_str, out_str)))
croak ("HB_GSUB_Apply_String", error);
dump_string (in_str);
dump_string (out_str);
if ((error = TT_GSUB_String_Done (in_str)))
croak ("TT_GSUB_String_New", error);
if ((error = TT_GSUB_String_Done (out_str)))
croak ("TT_GSUB_String_New", error);
if ((error = HB_GSUB_String_Done (in_str)))
croak ("HB_GSUB_String_New", error);
if ((error = HB_GSUB_String_Done (out_str)))
croak ("HB_GSUB_String_New", error);
}
#endif
......@@ -215,8 +213,8 @@ main (int argc, char **argv)
FT_Error error;
FT_Library library;
FT_Face face;
TTO_GSUB gsub;
TTO_GPOS gpos;
HB_GSUB gsub;
HB_GPOS gpos;
if (argc != 2)
{
......@@ -233,25 +231,25 @@ main (int argc, char **argv)
printf ("<?xml version=\"1.0\"?>\n");
printf ("<OpenType>\n");
if (!(error = TT_Load_GSUB_Table (face, &gsub, NULL)))
if (!(error = HB_Load_GSUB_Table (face, &gsub, NULL)))
{
TT_Dump_GSUB_Table (gsub, stdout);
HB_Dump_GSUB_Table (gsub, stdout);
if ((error = TT_Done_GSUB_Table (gsub)))
croak ("FT_Done_GSUB_Table", error);
if ((error = HB_Done_GSUB_Table (gsub)))
croak ("HB_Done_GSUB_Table", error);
}
else if (error != FT_Err_Table_Missing)
fprintf (stderr, "TT_Load_GSUB_Table %x\n", error);
fprintf (stderr, "HB_Load_GSUB_Table %x\n", error);
if (!(error = TT_Load_GPOS_Table (face, &gpos, NULL)))
if (!(error = HB_Load_GPOS_Table (face, &gpos, NULL)))
{
TT_Dump_GPOS_Table (gpos, stdout);
HB_Dump_GPOS_Table (gpos, stdout);
if ((error = TT_Done_GPOS_Table (gpos)))
croak ("FT_Done_GPOS_Table", error);
if ((error = HB_Done_GPOS_Table (gpos)))
croak ("HB_Done_GPOS_Table", error);
}
else if (error != FT_Err_Table_Missing)
fprintf (stderr, "TT_Load_GPOS_Table %x\n", error);
fprintf (stderr, "HB_Load_GPOS_Table %x\n", error);
printf ("</OpenType>\n");
......
/* Pango
* disasm.h: Dump OpenType layout tables
/* harfbuzz-dump.h: Dump OpenType layout tables
*
* Copyright (C) 2000 Red Hat Software
*
......@@ -18,9 +17,18 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef HARFBUZZ_DUMP_H
#define HARFBUZZ_DUMP_H
#include <stdio.h>
#include "ftxopen.h"
#include "harfbuzz-gsub.h"
#include "harfbuzz-gpos.h"
void TT_Dump_GSUB_Table (TTO_GSUB gsub, FILE *stream);
void TT_Dump_GPOS_Table (TTO_GPOS gpos, FILE *stream);
FT_BEGIN_HEADER
void HB_Dump_GSUB_Table (HB_GSUB gsub, FILE *stream);
void HB_Dump_GPOS_Table (HB_GPOS gpos, FILE *stream);
FT_END_HEADER
#endif /* HARFBUZZ_DUMP_H */
/*******************************************************************
*
* Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Copyright 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* See the file name COPYING for licensing information.
*
******************************************************************/
#ifndef HARFBUZZ_GDEF_PRIVATE_H
#define HARFBUZZ_GDEF_PRIVATE_H
#include "harfbuzz-gdef.h"
#include "harfbuzz-buffer.h"
FT_BEGIN_HEADER
/* Attachment related structures */
struct HB_AttachPoint_
{
FT_UShort PointCount; /* size of the PointIndex array */
FT_UShort* PointIndex; /* array of contour points */
};
/* Ligature Caret related structures */
struct HB_CaretValueFormat1_
{
FT_Short Coordinate; /* x or y value (in design units) */
};
typedef struct HB_CaretValueFormat1_ HB_CaretValueFormat1;
struct HB_CaretValueFormat2_
{
FT_UShort CaretValuePoint; /* contour point index on glyph */
};
typedef struct HB_CaretValueFormat2_ HB_CaretValueFormat2;
struct HB_CaretValueFormat3_
{
FT_Short Coordinate; /* x or y value (in design units) */
HB_Device Device; /* Device table for x or y value */
};
typedef struct HB_CaretValueFormat3_ HB_CaretValueFormat3;
struct HB_CaretValueFormat4_
{
FT_UShort IdCaretValue; /* metric ID */
};
typedef struct HB_CaretValueFormat4_ HB_CaretValueFormat4;
struct HB_CaretValue_
{
FT_UShort CaretValueFormat; /* 1, 2, 3, or 4 */
union
{
HB_CaretValueFormat1 cvf1;
HB_CaretValueFormat2 cvf2;
HB_CaretValueFormat3 cvf3;
HB_CaretValueFormat4 cvf4;
} cvf;
};
typedef struct HB_CaretValue_ HB_CaretValue;
struct HB_LigGlyph_
{
FT_Bool loaded;
FT_UShort CaretCount; /* number of caret values */
HB_CaretValue* CaretValue; /* array of caret values */
};
FT_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
FT_UShort glyphID,
FT_UShort property );
FT_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
HB_GlyphItem item,
FT_UShort flags,
FT_UShort* property );
FT_END_HEADER
#endif /* HARFBUZZ_GDEF_PRIVATE_H */
此差异已折叠。
/*******************************************************************
*
* Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Copyright 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* See the file name COPYING for licensing information.
*
******************************************************************/
#ifndef HARFBUZZ_GDEF_H
#define HARFBUZZ_GDEF_H
#include "harfbuzz-open.h"
FT_BEGIN_HEADER
#define HB_Err_Invalid_GDEF_SubTable_Format 0x1030
#define HB_Err_Invalid_GDEF_SubTable 0x1031
/* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding
* flag in the LookupFlag field. */
#define HB_GDEF_BASE_GLYPH 0x0002
#define HB_GDEF_LIGATURE 0x0004
#define HB_GDEF_MARK 0x0008
#define HB_GDEF_COMPONENT 0x0010
typedef struct HB_AttachPoint_ HB_AttachPoint;
struct HB_AttachList_
{
FT_Bool loaded;
HB_Coverage Coverage; /* Coverage table */
FT_UShort GlyphCount; /* number of glyphs with
attachments */
HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */
};
typedef struct HB_AttachList_ HB_AttachList;
typedef struct HB_LigGlyph_ HB_LigGlyph;
struct HB_LigCaretList_
{
FT_Bool loaded;
HB_Coverage Coverage; /* Coverage table */
FT_UShort LigGlyphCount; /* number of ligature glyphs */
HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */
};
typedef struct HB_LigCaretList_ HB_LigCaretList;
/* The `NewGlyphClasses' field is not defined in the TTO specification.
We use it for fonts with a constructed `GlyphClassDef' structure
(i.e., which don't have a GDEF table) to collect glyph classes
assigned during the lookup process. The number of arrays in this
pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth
array then contains the glyph class values of the glyphs not covered
by the ClassRangeRecords structures with index n-1 and n. We store
glyph class values for four glyphs in a single array element.
`LastGlyph' is identical to the number of glyphs minus one in the
font; we need it only if `NewGlyphClasses' is not NULL (to have an
upper bound for the last array).
Note that we first store the file offset to the `MarkAttachClassDef'
field (which has been introduced in OpenType 1.2) -- since the
`Version' field value hasn't been increased to indicate that we have
one more field for some obscure reason, we must parse the GSUB table
to find out whether class values refer to this table. Only then we
can finally load the MarkAttachClassDef structure if necessary. */
struct HB_GDEFHeader_
{
FT_Memory memory;
FT_ULong offset;
FT_Fixed Version;
HB_ClassDefinition GlyphClassDef;
HB_AttachList AttachList;
HB_LigCaretList LigCaretList;
FT_ULong MarkAttachClassDef_offset;
HB_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */
FT_UShort LastGlyph;
FT_UShort** NewGlyphClasses;
};
typedef struct HB_GDEFHeader_ HB_GDEFHeader;
typedef struct HB_GDEFHeader_* HB_GDEF;
FT_Error HB_New_GDEF_Table( FT_Face face,
HB_GDEFHeader** retptr );
FT_Error HB_Load_GDEF_Table( FT_Face face,
HB_GDEFHeader** gdef );
FT_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef );
FT_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
FT_UShort glyphID,
FT_UShort* property );
FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
FT_UShort num_glyphs,
FT_UShort glyph_count,
FT_UShort* glyph_array,
FT_UShort* class_array );
FT_END_HEADER
#endif /* HARFBUZZ_GDEF_H */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册