Bug 1220591 - Update graphite2 to release 1.3.4. r=jdaggett

This commit is contained in:
Jonathan Kew 2015-11-04 07:07:15 +00:00
Родитель 84f5ecb5d0
Коммит f2f1669512
30 изменённых файлов: 858 добавлений и 77 удалений

181
gfx/graphite2/ChangeLog Normal file
Просмотреть файл

@ -0,0 +1,181 @@
1.3.4
. Transition from Mercurial to Git
. Bug fixes
. Fix Collision Kerning ignoring some diacritics
. Handle pass bits 16-31 to speed up fonts with > 16 passes
. Various minor fuzz bug fixes
. Make Coverity happy
. Add GR_FALLTHROUGH macro for clang c++11
1.3.3
. Slight speed up in Collision Avoidance
. Remove dead bidi code
. Bug fixes
. Between pass bidi reorderings and at the end
. Decompressor fuzz bugs
. Other fuzz bugs
1.3.2
. Remove full bidi. All segments are assumed to be single directioned.
. Bug fixes:
. Decompressor corner cases
. Various fuzz bugs
1.3.1
. Deprecation warning: Full bidi support is about to be deprecated. Make contact
if this impacts you.
. Change compression block format slightly to conform to LZ4
. Bug fixes:
. Handle mono direction text with diacritics consistently. Fonts
now see the direction they expect consistently and bidi now
gives expected results.
. Fixed lots of fuzz bugs
. Coverity cleanups
. Build now works for clang and/or asan and/or afl etc.
1.3.0
. Add collision avoidance
. Shift Collider
. Kern Collider
. Octabox outlines and subboxes
. Add compressed Silf and Glat table support
. Bug fixes:
. Stop loops forming in the child, sibling tree
. Handle bidi mirroring correctly if no bidi occurring
1.2.4
. Face failure now has error code reporting via debug logging
. can now call gr_start_logging(NULL, fname)
. gr2fonttest --alltrace added
. Format 14 table support
. Not done. To be handled entirely in the compiler
. Bidi support for Unicode 6.3 Isolating direction controls
. Fonts no longer require a glyf/loca table. In such cases the bounding box is always 0.
. Clang ASAN build support added for testing.
. Handle out of memory sanely.
. Documentation improvements
. Bug fixes:
. Enforce fonts having to store glyph attributes by monotonically increasing attribute number
. zeropadding was not getting called on feature tags
. automatic associations for unassociated characters
. use direct engine on Mac
. various extreme case reading 1 past the end errors fixed
. remove tabs from sources so that it becomes readable again
1.2.3
. Bug fixes only:
. fix byte swapping when testing cmap subtable lengths
. work around armel compilation problems with conditional operators
. fix pseudoglyph support for advance and bbox
1.2.2
. Add support for passKeySlot (makes Charis 2x faster) up to 32 passes
. Add telemetry output to json if enabled in build GRAPHITE2_TELEMETRY
. Shrink font memory footprint particularly in the fsm
. Add -S to comparerenderer
. Bug fixes:
. Fix shift.x being reversed for rtl text
. Fix faulty fallback justification
. Fix bad cmap handling
. Support compiling on old Solaris where bidi attributes clash with register names
. Follow the crowd in using Windows.h
1.2.1
. Bug fixes:
. Allow glyph reattachment
. Allow signed glyph attributes
. Various build problems with MacOS, old gcc versions, etc.
. Various overrun read errors fixed
1.2.0
. API Changes:
. Added Windows friendly gr_start_logging and gr_stop_logging, now per face
. Added gr_make_face_with_ops, gr_make_face_with_seg_cache_and_ops
. Added gr_make_font_with_ops
. Added gr_face_is_char_supported
. Added gr_face_info to give info to apps about face capabilities
. Deprecated gr_make_face, gr_make_face_with_seg_cache, gr_make_font_with_advance_fn
. Deprecated graphite_start_logging and graphite_stop_logging
. These functions are stubbed now and do nothing, but do compile and link.
. Bump API version to 3
. Add C# wrapper to contrib
. Handle justification information in a font and do something useful with it
. Builds clang clean (has done for a while)
. Bug fixes
. Windows build and bug fixes
. Add extra information to json debug output
. Added windows build documentation
. Added freetype sample code and test
1.1.3
. Default build has GRAPHITE2_COMPARE_RENDERER to OFF to reduce dependencies
. Builds on Mac with clang
. Debug output improvements
. Tidy up perl wrappers
. Fuzz tester improvements
. Various bug fixes for bad font handling
1.1.2
. Support feature ids < 4 chars when space padded for inclusion in FF 14.
. More fuzztesting and removal of causes of valgrind bad reads and sigabrts
. Remove contrib/android into its own repo (http://hg.palaso.org/grandroid)
. Update comparerenderer to latest harfbuzzng api
1.1.1
. Missing Log.h included
. perl wrappers updated
1.1.0
. Refactored debug output to use json
. Renamed VM_MACHINE_TYPE to GRAPHITE2_VM_TYPE
. Renamed DISABLE_SEGCACHE to GRAPHITE2_NSEGCACE
. Renamed DISBALE_FILE_FACE to GRAPHITE2_NFILEFACE
. Renamed ENABLE_COMPARE_RENDERER to GRAPHTIE2_COMPARE_RENDERER
. Renamed DOXYGEN_CONFIG to GRAPHITE2_DOXYGEN_CONFIG
. Renamed GR2_CUSTOM_HEADER to GRAPHITE2_CUSTOM_HEADER
. Renamed GR2_EXPORTING to GRAPHITE2_EXPORTING
. Added GRAPHITE2_STATIC for static only builds
. Added GRAPHITE2_NTRACING to compile out tracing code
. Documented GRAPHITE2_{EXPORTING,STATIC,NTRACING} in hacking.txt
. Bump libtool version to 2.1.0
. dumb font rendering works
. slot user attributes are now signed rather than unsigned
. add support for long class maps
. Rename perl library to avoid nameclash on Windows
. Various robustness fixes
. Moved internal .h files into src/inc
. Parallelise fuzztest
. General build improvements, particularly on Windows
1.0.3
. Fix UTF16 surrogate support
. script and lang tags may be space padded or null padded
. Remove need for WORDS_BIGENDIAN, do it all automatically
. Remove all #include <new>. Use CLASS_NEW_DELETE instead.
. Fix comparerenderer to work with current hbng
. Add valgrind to fuzztest to ensure good memory use at all times
. Fix new fuzztest exposed bugs.
. Fix bugs exposed by Mozilla security review
. Add continuous integration build on Windows support
1.0.2
. Fix Windows build
. Comparerenderer uses hbng enforcing ot rendering
. Add Bidi .hasChar support and refactor mirroring code
. Make cmake default Release rather than debug
. Don't compile in a boat load of TtfUtil that isn't used, saving 15% of binary
. Chase the FSF around its latest office moves
. WORDS_BIGENDIAN is set at the top so tests now pass on ppc, etc.
. More words in the manual
1.0.1
. Release is the default build in cmake now.
. Refactor cmake build to not rebuild things so much.
. Include a missing file
. Remove -nostdlibs, making gcc happy everywhere
. Update comparerenderer to latest hbng interface
. Add changelog
1.0.0
. First major release of perfect code!

510
gfx/graphite2/LICENSE Normal file
Просмотреть файл

@ -0,0 +1,510 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations
below.
When we speak of free software, we are referring to freedom of use,
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 and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it
becomes a de-facto standard. To achieve this, non-free programs must
be allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, 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 library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete 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 distribute a copy of this License along with the
Library.
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 Library or any portion
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
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 Library, 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 Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you 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.
If distribution of 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 satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least
three years, to give the same user the materials specified in
Subsection 6a, above, for a charge no more than the cost of
performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be 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.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library 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.
9. 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 Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
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 with
this License.
11. 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 Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library 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 Library.
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.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library 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.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
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 Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
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
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. 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 LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms
of the ordinary General Public License).
To apply these terms, attach the following notices to the library.
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 library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or
your school, if any, to sign a "copyright disclaimer" for the library,
if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James
Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

32
gfx/graphite2/README.md Normal file
Просмотреть файл

@ -0,0 +1,32 @@
# Graphite engine
## What is Graphite?
Graphite is a system that can be used to create “smart fonts” capable of displaying writing systems with various complex behaviors. A smart font contains not only letter shapes but also additional instructions indicating how to combine and position the letters in complex ways.
Graphite was primarily developed to provide the flexibility needed for minority languages which often need to be written according to slightly different rules than well-known languages that use the same script.
Examples of complex script behaviors Graphite can handle include:
* contextual shaping
* ligatures
* reordering
* split glyphs
* bidirectionality
* stacking diacritics
* complex positioning
* shape aware kerning
* automatic diacritic collision avoidance
See [examples of scripts with complex rendering](http://scripts.sil.org/CmplxRndExamples).
## Graphite system overview
The Graphite system consists of:
* A rule-based programming language [Graphite Description Language](http://scripts.sil.org/cms/scripts/page.php?site_id=projects&item_id=graphite_devFont#gdl) (GDL) that can be used to describe the behavior of a writing system
* A compiler for that language
* A rendering engine that can serve as the layout component of a text-processing application
Graphite renders TrueType fonts that have been extended by means of compiling a GDL program.
Further technical information is available on the [Graphite technical overview](http://scripts.sil.org/cms/scripts/page.php?site_id=projects&item_id=graphite_techAbout) page.

Просмотреть файл

@ -1,6 +1,3 @@
This directory contains the Graphite2 library from http://hg.palaso.org/graphitedev
Current version derived from upstream changeset ff457b44c490
See gfx/graphite2/moz-gr-update.sh for update procedure.
This directory contains the Graphite2 library release 1.3.4 from
https://github.com/silnrsi/graphite/releases/download/1.3.4/graphite2-minimal-1.3.4.tgz
See ./gfx/graphite2/moz-gr-update.sh for update procedure.

Просмотреть файл

@ -30,7 +30,7 @@
#define GR2_VERSION_MAJOR 1
#define GR2_VERSION_MINOR 3
#define GR2_VERSION_BUGFIX 3
#define GR2_VERSION_BUGFIX 4
#ifdef __cplusplus
extern "C"

Просмотреть файл

@ -5,26 +5,40 @@
# This script lives in gfx/graphite2, along with the library source,
# but must be run from the top level of the mozilla-central tree.
# It expects to find a checkout of the graphite2 tree in a directory "graphitedev"
# alongside the current mozilla tree that is to be updated.
# Expect error messages from the copy commands if this is not found!
# Run as
#
# ./gfx/graphite2/moz-gr-update.sh RELEASE
#
# where RELEASE is the graphite2 release to be used, e.g. "1.3.4".
# copy the source and headers
cp -R ../graphitedev/src/* gfx/graphite2/src
cp ../graphitedev/include/graphite2/* gfx/graphite2/include/graphite2
RELEASE=$1
# record the upstream changeset that was used
CHANGESET=$(cd ../graphitedev/ && hg log | head -n 1 | cut -d : -f 1,3 | sed -e 's/:/ /')
echo "This directory contains the Graphite2 library from http://hg.palaso.org/graphitedev\n" > gfx/graphite2/README.mozilla
echo "Current version derived from upstream" $CHANGESET >> gfx/graphite2/README.mozilla
echo "\nSee" $0 "for update procedure.\n" >> gfx/graphite2/README.mozilla
if [ "x$RELEASE" == "x" ]
then
echo "Must provide the version number to be used."
exit 1
fi
TARBALL="https://github.com/silnrsi/graphite/releases/download/$RELEASE/graphite2-minimal-$RELEASE.tgz"
foo=`basename $0`
TMPFILE=`mktemp -t ${foo}` || exit 1
curl -L "$TARBALL" -o "$TMPFILE"
tar -x -z -C gfx/graphite2/ --strip-components 1 -f "$TMPFILE" || exit 1
rm "$TMPFILE"
echo "This directory contains the Graphite2 library release $RELEASE from" > gfx/graphite2/README.mozilla
echo "$TARBALL" >> gfx/graphite2/README.mozilla
echo ""
echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
# fix up includes because of bug 721839 (cstdio) and bug 803066 (Windows.h)
find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
#find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
#find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
# summarize what's been touched
echo Updated to $CHANGESET.
echo Updated to $RELEASE.
echo Here is what changed in the gfx/graphite2 directory:
echo

Просмотреть файл

@ -114,6 +114,10 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-Wdouble-promotion)
endif (CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "Compiler ID is: ${CMAKE_CXX_COMPILER_ID}")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
add_definitions(-Wimplicit-fallthrough)
endif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
if (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*")
target_link_libraries(graphite2 kernel32 msvcr90 mingw32 gcc user32)
else (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*")
@ -131,7 +135,7 @@ endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set_target_properties(graphite2 PROPERTIES
COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-stack-protector"
COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wimplicit-fallthrough -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-stack-protector"
LINK_FLAGS "-nodefaultlibs"
LINKER_LANGUAGE C)
target_link_libraries(graphite2 c)

Просмотреть файл

@ -42,7 +42,7 @@ of the License or (at your option) any later version.
#include "inc/Rule.h"
#include "inc/Silf.h"
#include <stdio.h>
#include <cstdio>
#ifdef NDEBUG
#ifdef __GNUC__
@ -421,6 +421,7 @@ opcode Machine::Code::decoder::fetch_opcode(const byte * bc)
case POP_RET :
if (--_stack_depth < 0)
failure(underfull_stack);
GR_FALLTHROUGH;
// no break
case RET_ZERO :
case RET_TRUE :
@ -504,6 +505,7 @@ void Machine::Code::decoder::analyse_opcode(const opcode opc, const int8 * arg)
case PUT_SUBS :
_code._modify = true;
_analysis.set_changed(0);
GR_FALLTHROUGH;
// no break
case PUT_COPY :
{
@ -516,6 +518,7 @@ void Machine::Code::decoder::analyse_opcode(const opcode opc, const int8 * arg)
}
case PUSH_ATT_TO_GATTR_OBS : // slotref on 2nd parameter
if (_code._constraint) return;
GR_FALLTHROUGH;
// no break
case PUSH_GLYPH_ATTR_OBS :
case PUSH_SLOT_ATTR :
@ -530,6 +533,7 @@ void Machine::Code::decoder::analyse_opcode(const opcode opc, const int8 * arg)
break;
case PUSH_ATT_TO_GLYPH_ATTR :
if (_code._constraint) return;
GR_FALLTHROUGH;
// no break
case PUSH_GLYPH_ATTR :
if (arg[2] <= 0 && -arg[2] <= _analysis.slotref - _analysis.contexts[_analysis.slotref].flags.inserted)
@ -594,7 +598,10 @@ bool Machine::Code::decoder::emit_opcode(opcode opc, const byte * & bc)
_pre_context = 0;
}
else
{
_pre_context = 0;
return false;
}
}
return bool(_code);

Просмотреть файл

@ -896,7 +896,7 @@ bool KernCollider::initSlot(Segment *seg, Slot *aSlot, const Rect &limit, float
float y = _miny - 1 + (i + .5f) * _sliceWidth; // vertical center of slice
if ((dir & 1) && x < _edges[i])
{
t = get_edge(seg, s, currShift, y, _sliceWidth, false);
t = get_edge(seg, s, c->shift(), y, _sliceWidth, false);
if (t < _edges[i])
{
_edges[i] = t;
@ -906,7 +906,7 @@ bool KernCollider::initSlot(Segment *seg, Slot *aSlot, const Rect &limit, float
}
else if (!(dir & 1) && x > _edges[i])
{
t = get_edge(seg, s, currShift, y, _sliceWidth, true);
t = get_edge(seg, s, c->shift(), y, _sliceWidth, true);
if (t > _edges[i])
{
_edges[i] = t;
@ -993,6 +993,9 @@ Position KernCollider::resolve(GR_MAYBE_UNUSED Segment *seg, GR_MAYBE_UNUSED Slo
<< "gid" << _target->gid()
<< "margin" << _margin
<< "limit" << _limit
<< "miny" << _miny
<< "maxy" << _maxy
<< "slicewidth" << _sliceWidth
<< "target" << json::object
<< "origin" << _target->origin()
//<< "currShift" << _currShift
@ -1000,8 +1003,6 @@ Position KernCollider::resolve(GR_MAYBE_UNUSED Segment *seg, GR_MAYBE_UNUSED Slo
<< "bbox" << seg->theGlyphBBoxTemporary(_target->gid())
<< "slantBox" << seg->getFace()->glyphs().slant(_target->gid())
<< "fix" << "kern"
<< "slices" << _edges.size()
<< "sliceWidth" << _sliceWidth
<< json::close; // target object
*dbgout << "slices" << json::array;

Просмотреть файл

@ -85,7 +85,7 @@ int lz4::decompress(void const *in, size_t in_size, void *out, size_t out_size)
{
// Copy in literal. At this point the last full sequence must be at
// least MINMATCH + 5 from the end of the output buffer.
if (dst + align(literal_len) > dst_end - MINMATCH+5)
if (dst + align(literal_len) > dst_end - (MINMATCH+5))
return -1;
dst = overrun_copy(dst, literal, literal_len);
}

Просмотреть файл

@ -330,9 +330,9 @@ Error Face::Table::decompress()
{
uncompressed_size = hdr & 0x07ffffff;
uncompressed_table = gralloc<byte>(uncompressed_size);
//TODO: Coverty: 1315803: FORWARD_NULL
if (!e.test(!uncompressed_table, E_OUTOFMEM))
//TODO: Coverty: 1315800: CHECKED_RETURN
// coverity[forward_null : FALSE] - uncompressed_table has been checked so can't be null
// coverity[checked_return : FALSE] - we test e later
e.test(lz4::decompress(p, _sz - 2*sizeof(uint32), uncompressed_table, uncompressed_size) != signed(uncompressed_size), E_SHRINKERFAILED);
break;
}
@ -343,7 +343,8 @@ Error Face::Table::decompress()
// Check the uncompressed version number against the original.
if (!e)
//TODO: Coverty: 1315800: CHECKED_RETURN
// coverity[forward_null : FALSE] - uncompressed_table has already been tested so can't be null
// coverity[checked_return : FALSE] - we test e later
e.test(be::peek<uint32>(uncompressed_table) != version, E_SHRINKERFAILED);
// Tell the provider to release the compressed form since were replacing
@ -358,7 +359,7 @@ Error Face::Table::decompress()
}
_p = uncompressed_table;
_sz = uncompressed_size + sizeof(uint32);
_sz = uncompressed_size;
_compressed = true;
return e;

Просмотреть файл

@ -299,7 +299,13 @@ GlyphCache::Loader::Loader(const Face & face, const bool dumb_font)
_head = Face::Table();
return;
}
_has_boxes = (version == 0x00030000);
else if (version >= 0x00030000)
{
unsigned int glatflags = be::read<uint32>(p);
_has_boxes = glatflags & 1;
// delete this once the compiler is fixed
_has_boxes = true;
}
}
}

Просмотреть файл

@ -155,6 +155,7 @@ void Zones::remove(float x, float xm)
{
case 0: // i completely covers e
if (separated(i->x, x)) { i = _exclusions.insert(i,i->split_at(x)); ++i; }
GR_FALLTHROUGH;
// no break
case 1: // i overlaps on the rhs of e
i->left_trim(xm);
@ -162,6 +163,7 @@ void Zones::remove(float x, float xm)
case 2: // i overlaps on the lhs of e
i->xm = x;
if (separated(i->x, i->xm)) break;
GR_FALLTHROUGH;
// no break
case 3: // e completely covers i
i = _exclusions.erase(i);

Просмотреть файл

@ -165,7 +165,7 @@ float Segment::justify(Slot *pSlot, const Font *font, float width, GR_MAYBE_UNUS
if (-pref > max) pref = -max;
else tWeight += w;
}
int actual = step ? int(pref / step) * step : int(pref);
int actual = int(pref / step) * step;
if (actual)
{

Просмотреть файл

@ -126,7 +126,8 @@ bool Pass::readPass(const byte * const pass_start, size_t pass_length, size_t su
if ( e.test(m_numTransition > m_numStates, E_BADNUMTRANS)
|| e.test(m_numSuccess > m_numStates, E_BADNUMSUCCESS)
|| e.test(m_numSuccess + m_numTransition < m_numStates, E_BADNUMSTATES)
|| e.test(m_numRules && numRanges == 0, E_NORANGES))
|| e.test(m_numRules && numRanges == 0, E_NORANGES)
|| e.test(m_numColumns > 0x7FFF, E_BADNUMCOLUMNS))
return face.error(e);
m_successStart = m_numStates - m_numSuccess;

Просмотреть файл

@ -61,7 +61,8 @@ SegCacheEntry::SegCacheEntry(const uint16* cmapGlyphs, size_t length, Segment *
}
const Slot * slot = seg->first();
m_glyph = new Slot[glyphCount];
m_attr = gralloc<int16>(glyphCount * seg->numAttrs());
int attrSize = seg->numAttrs() + (seg->hasCollisionInfo() ? (sizeof(SlotCollision) + 1) / 2 : 0);
m_attr = gralloc<int16>(glyphCount * attrSize);
if (!m_glyph || (!m_attr && seg->numAttrs())) return;
m_glyphLength = glyphCount;
Slot * slotCopy = m_glyph;
@ -70,9 +71,9 @@ SegCacheEntry::SegCacheEntry(const uint16* cmapGlyphs, size_t length, Segment *
uint16 pos = 0;
while (slot)
{
slotCopy->userAttrs(m_attr + pos * seg->numAttrs());
slotCopy->userAttrs(m_attr + pos * attrSize);
slotCopy->m_justs = m_justs ? reinterpret_cast<SlotJustify *>(m_justs + justs_pos++ * sizeof_sjust) : 0;
slotCopy->set(*slot, -static_cast<int32>(charOffset), seg->numAttrs(), seg->silf()->numJustLevels(), length);
slotCopy->set(*slot, -static_cast<int32>(charOffset), attrSize, seg->silf()->numJustLevels(), length);
slotCopy->index(pos);
if (slot->firstChild())
slotCopy->m_child = m_glyph + slot->firstChild()->index();

Просмотреть файл

@ -46,7 +46,6 @@ Segment::Segment(unsigned int numchars, const Face* face, uint32 script, int tex
: m_freeSlots(NULL),
m_freeJustifies(NULL),
m_charinfo(new CharInfo[numchars]),
m_collisions(NULL),
m_face(face),
m_silf(face->chooseSilf(script)),
m_first(NULL),
@ -57,7 +56,7 @@ Segment::Segment(unsigned int numchars, const Face* face, uint32 script, int tex
m_passBits(m_silf->aPassBits() ? -1 : 0),
m_defaultOriginal(0),
m_dir(textDir),
m_flags(0)
m_flags(((m_silf->flags() & 0x20) != 0) << 1)
{
freeSlot(newSlot());
m_bufSize = log_binary(numchars)+1;
@ -176,11 +175,17 @@ Slot *Segment::newSlot()
if (m_face->logger()) ++numUser;
#endif
Slot *newSlots = grzeroalloc<Slot>(m_bufSize);
int16 *newAttrs = grzeroalloc<int16>(numUser * m_bufSize);
if (!newSlots || !newAttrs) return NULL;
int attrSize = numUser + (hasCollisionInfo() ? ((sizeof(SlotCollision) + 1) / 2) : 0);
int16 *newAttrs = grzeroalloc<int16>(m_bufSize * attrSize);
if (!newSlots || !newAttrs)
{
free(newSlots);
free(newAttrs);
return NULL;
}
for (size_t i = 0; i < m_bufSize; i++)
{
::new (newSlots + i) Slot(newAttrs + i * numUser);
::new (newSlots + i) Slot(newAttrs + i * attrSize);
newSlots[i].next(newSlots + i + 1);
}
newSlots[m_bufSize - 1].next(NULL);
@ -209,7 +214,8 @@ void Segment::freeSlot(Slot *aSlot)
}
// reset the slot incase it is reused
::new (aSlot) Slot(aSlot->userAttrs());
memset(aSlot->userAttrs(), 0, m_silf->numUser() * sizeof(int16));
int attrSize = m_silf->numUser() + (hasCollisionInfo() ? ((sizeof(SlotCollision) + 1) / 2) : 0);
memset(aSlot->userAttrs(), 0, attrSize * sizeof(int16));
// Update generation counter for debug
#if !defined GRAPHITE2_NTRACING
if (m_face->logger())
@ -298,13 +304,14 @@ void Segment::splice(size_t offset, size_t length, Slot * const startSlot,
assert(offset + numChars <= m_numCharinfo);
Slot * indexmap[eMaxSpliceSize*3];
assert(numGlyphs < sizeof indexmap/sizeof *indexmap);
int attrSize = m_silf->numUser() + (hasCollisionInfo() ? ((sizeof(SlotCollision) + 1) / 2) : 0);
Slot * slot = startSlot;
for (uint16 i=0; i < numGlyphs; slot = slot->next(), ++i)
indexmap[i] = slot;
for (slot = startSlot; slot != endSlot; slot = slot->next(), srcSlot = srcSlot->next())
{
slot->set(*srcSlot, offset, m_silf->numUser(), m_silf->numJustLevels(), numChars);
slot->set(*srcSlot, offset, attrSize, m_silf->numJustLevels(), numChars);
if (srcSlot->attachedTo()) slot->attachTo(indexmap[srcSlot->attachedTo()->index()]);
if (srcSlot->nextSibling()) slot->m_sibling = indexmap[srcSlot->nextSibling()->index()];
if (srcSlot->firstChild()) slot->m_child = indexmap[srcSlot->firstChild()->index()];
@ -516,14 +523,7 @@ void Segment::doMirror(uint16 aMirror)
bool Segment::initCollisions()
{
if (m_collisions) free(m_collisions);
Slot *p = m_first;
m_collisions = gralloc<SlotCollision>(slotCount());
if (!m_collisions) return false;
for (unsigned short i = 0; i < slotCount(); ++i)
{
::new (m_collisions + p->index()) SlotCollision(this, p);
p = p->next();
}
for (Slot *p = m_first; p; p = p->next())
::new (collisionInfo(p)) SlotCollision(this, p);
return true;
}

Просмотреть файл

@ -394,7 +394,7 @@ bool Silf::runGraphite(Segment *seg, uint8 firstPass, uint8 lastPass, int dobidi
<< json::close;
}
#endif
if (seg->currdir() != m_dir)
if (seg->currdir() != (m_dir & 1))
seg->reverseSlots();
if (m_aMirror && (seg->dir() & 3) == 3)
seg->doMirror(m_aMirror);

Просмотреть файл

@ -46,7 +46,7 @@ Slot::Slot(int16 *user_attrs) :
}
// take care, this does not copy any of the GrSlot pointer fields
void Slot::set(const Slot & orig, int charOffset, size_t numUserAttr, size_t justLevels, size_t numChars)
void Slot::set(const Slot & orig, int charOffset, size_t sizeAttr, size_t justLevels, size_t numChars)
{
// leave m_next and m_prev unchanged
m_glyphid = orig.m_glyphid;
@ -73,7 +73,7 @@ void Slot::set(const Slot & orig, int charOffset, size_t numUserAttr, size_t jus
m_bidiCls = orig.m_bidiCls;
m_bidiLevel = orig.m_bidiLevel;
if (m_userAttr && orig.m_userAttr)
memcpy(m_userAttr, orig.m_userAttr, numUserAttr * sizeof(*m_userAttr));
memcpy(m_userAttr, orig.m_userAttr, sizeAttr * sizeof(*m_userAttr));
if (m_justs && orig.m_justs)
memcpy(m_justs, orig.m_justs, SlotJustify::size_of(justLevels));
}
@ -469,7 +469,11 @@ void Slot::setGlyph(Segment *seg, uint16 glyphid, const GlyphFace * theGlyph)
}
m_advance = Position(aGlyph->theAdvance().x, 0.);
if (seg->silf()->aPassBits())
{
seg->mergePassBits(theGlyph->attrs()[seg->silf()->aPassBits()]);
if (seg->silf()->numPasses() > 16)
seg->mergePassBits(theGlyph->attrs()[seg->silf()->aPassBits()+1] << 16);
}
}
void Slot::floodShift(Position adj)
@ -501,7 +505,8 @@ Slot * Slot::nextInCluster(const Slot *s) const
return s->nextSibling();
while ((base = s->attachedTo()))
{
if (base->firstChild() == s && base->nextSibling())
// if (base->firstChild() == s && base->nextSibling())
if (base->nextSibling())
return base->nextSibling();
s = base;
}

Просмотреть файл

@ -852,11 +852,11 @@ const void * FindCmapSubtable(const void * pCmap, int nPlatformId, /* =3 */ int
const uint8 * pRtn = reinterpret_cast<const uint8 *>(pCmap) + offset;
if (length)
{
if (offset + 2 > length) return NULL;
if (offset > length - 2) return NULL;
uint16 format = be::read<uint16>(pRtn);
if (format == 4)
{
if (offset + 4 > length) return NULL;
if (offset > length - 4) return NULL;
uint16 subTableLength = be::peek<uint16>(pRtn);
if (i + 1 == csuPlatforms)
{
@ -868,7 +868,7 @@ const void * FindCmapSubtable(const void * pCmap, int nPlatformId, /* =3 */ int
}
if (format == 12)
{
if (offset + 6 > length) return NULL;
if (offset > length - 6) return NULL;
uint32 subTableLength = be::peek<uint32>(pRtn);
if (i + 1 == csuPlatforms)
{
@ -1210,7 +1210,7 @@ size_t LocaLookup(gid16 nGlyphId,
// CheckTable verifies the index_to_loc_format is valid
if (be::swap(pTable->index_to_loc_format) == Sfnt::FontHeader::ShortIndexLocFormat)
{ // loca entries are two bytes and have been divided by two
if (nGlyphId < (lLocaSize >> 1) - 1) // allow sentinel value to be accessed
if (lLocaSize > 1 && nGlyphId + 1u < lLocaSize >> 1) // allow sentinel value to be accessed
{
const uint16 * pShortTable = reinterpret_cast<const uint16 *>(pLoca);
res = be::peek<uint16>(pShortTable + nGlyphId) << 1;
@ -1220,7 +1220,7 @@ size_t LocaLookup(gid16 nGlyphId,
}
else if (be::swap(pTable->index_to_loc_format) == Sfnt::FontHeader::LongIndexLocFormat)
{ // loca entries are four bytes
if (nGlyphId < (lLocaSize >> 2) - 1)
if (lLocaSize > 3 && nGlyphId + 1u < lLocaSize >> 2)
{
const uint32 * pLongTable = reinterpret_cast<const uint32 *>(pLoca);
res = be::peek<uint32>(pLongTable + nGlyphId);

Просмотреть файл

@ -24,7 +24,7 @@ Mozilla Public License (http://mozilla.org/MPL) or 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.
*/
#include <stdio.h>
#include <cstdio>
#include "graphite2/Log.h"
#include "inc/debug.h"

Просмотреть файл

@ -115,6 +115,7 @@ enum errors {
E_BADEMPTYPASS = 54, // Can't have empty passes (no rules) except for collision passes
E_BADSILFVERSION = 55, // The Silf table has a bad version (probably too high)
E_BADCOLLISIONPASS = 56, // Collision flags set on a non positioning pass
E_BADNUMCOLUMNS = 57, // Arbitrarily limit number of columns in fsm
// Code errors
E_CODEFAILURE = 60, // Base code error. The following subcodes must align with Machine::Code::status_t in Code.h
E_CODEALLOC = 61, // Out of memory

Просмотреть файл

@ -26,7 +26,7 @@ of the License or (at your option) any later version.
*/
#pragma once
#include <stdio.h>
#include <cstdio>
#include "graphite2/Font.h"

Просмотреть файл

@ -32,7 +32,7 @@ of the License or (at your option) any later version.
#ifndef GRAPHITE2_NFILEFACE
#include <stdio.h>
#include <cstdio>
#include <cassert>
#include "graphite2/Font.h"

Просмотреть файл

@ -120,12 +120,26 @@ inline T max(const T a, const T b)
void operator delete[] (void * p)throw() { free(p); } \
void operator delete[] (void *, void *) throw() {}
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__clang__)
#define GR_MAYBE_UNUSED __attribute__((unused))
#else
#define GR_MAYBE_UNUSED
#endif
#if defined(__clang__) && __cplusplus >= 201103L
/* clang's fallthrough annotations are only available starting in C++11. */
#define GR_FALLTHROUGH [[clang::fallthrough]]
#elif defined(_MSC_VER)
/*
* MSVC's __fallthrough annotations are checked by /analyze (Code Analysis):
* https://msdn.microsoft.com/en-us/library/ms235402%28VS.80%29.aspx
*/
#include <sal.h>
#define GR_FALLTHROUGH __fallthrough
#else
#define GR_FALLTHROUGH /* fallthrough */
#endif
#ifdef _MSC_VER
#pragma warning(disable: 4800)
#pragma warning(disable: 4355)

Просмотреть файл

@ -87,7 +87,8 @@ class Segment
public:
enum {
SEG_INITCOLLISIONS = 1
SEG_INITCOLLISIONS = 1,
SEG_HASCOLLISIONS = 2
};
unsigned int slotCount() const { return m_numGlyphs; } //one slot per glyph
@ -158,8 +159,8 @@ public:
void reverseSlots();
bool isWhitespace(const int cid) const;
bool hasCollisionInfo() const { return m_collisions != 0; }
SlotCollision *collisionInfo(const Slot *s) const { return m_collisions ? m_collisions + s->index() : NULL; }
bool hasCollisionInfo() const { return (m_flags & SEG_HASCOLLISIONS); }
SlotCollision *collisionInfo(const Slot *s) const { return hasCollisionInfo() ? reinterpret_cast<SlotCollision *>(s->userAttrs() + m_silf->numUser()) : 0; }
CLASS_NEW_DELETE
@ -178,7 +179,6 @@ private:
Slot * m_freeSlots; // linked list of free slots
SlotJustify * m_freeJustifies; // Slot justification blocks free list
CharInfo * m_charinfo; // character info, one per input character
SlotCollision * m_collisions; // Array of SlotCollisions for each slot
const Face * m_face; // GrFace
const Silf * m_silf;
Slot * m_first; // first slot in segment
@ -197,7 +197,7 @@ int8 Segment::getSlotBidiClass(Slot *s) const
{
int8 res = s->getBidiClass();
if (res != -1) return res;
res = glyphAttr(s->gid(), m_silf->aBidi());
res = int8(glyphAttr(s->gid(), m_silf->aBidi()));
s->setBidiClass(res);
return res;
}

Просмотреть файл

@ -127,6 +127,7 @@ sparse::sparse(I attr, const I last)
return;
}
// coverity[forward_null : FALSE] Since m_array is union and m_array.values is not NULL
chunk * ci = m_array.map;
ci->offset = (m_nchunks*sizeof(chunk) + sizeof(mapped_type)-1)/sizeof(mapped_type);
mapped_type * vi = m_array.values + ci->offset;

Просмотреть файл

@ -131,9 +131,12 @@ public:
bool toolong = false;
switch(seq_sz) {
case 4: u <<= 6; u |= *++cp & 0x3F; if (*cp >> 6 != 2) break; ++l; toolong = (u < 0x10); // no break
case 3: u <<= 6; u |= *++cp & 0x3F; if (*cp >> 6 != 2) break; ++l; toolong |= (u < 0x20); // no break
case 2: u <<= 6; u |= *++cp & 0x3F; if (*cp >> 6 != 2) break; ++l; toolong |= (u < 0x80); // no break
case 4: u <<= 6; u |= *++cp & 0x3F; if (*cp >> 6 != 2) break; ++l; toolong = (u < 0x10); GR_FALLTHROUGH;
// no break
case 3: u <<= 6; u |= *++cp & 0x3F; if (*cp >> 6 != 2) break; ++l; toolong |= (u < 0x20); GR_FALLTHROUGH;
// no break
case 2: u <<= 6; u |= *++cp & 0x3F; if (*cp >> 6 != 2) break; ++l; toolong |= (u < 0x80); GR_FALLTHROUGH;
// no break
case 1: break;
case 0: l = -1; return 0xFFFD;
}

Просмотреть файл

@ -32,7 +32,7 @@ of the License or (at your option) any later version.
#include "inc/Main.h"
#include <cassert>
#include <stdio.h>
#include <cstdio>
#include "inc/List.h"
namespace graphite2 {

Просмотреть файл

@ -29,7 +29,7 @@ of the License or (at your option) any later version.
#if !defined GRAPHITE2_NTRACING
#include <stdio.h>
#include <cstdio>
#include <limits>
#include "inc/json.h"