mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 805760 - update graphite2 lib to commit 51e72e74b9a6. r=jdaggett
This commit is contained in:
parent
451f6ddf77
commit
509fb43edc
6
gfx/graphite2/README.mozilla
Normal file
6
gfx/graphite2/README.mozilla
Normal file
@ -0,0 +1,6 @@
|
||||
This directory contains the Graphite2 library from http://hg.palaso.org/graphitedev
|
||||
|
||||
Current version derived from upstream changeset 51e72e74b9a6
|
||||
|
||||
See gfx/graphite2/moz-gr-update.sh for update procedure.
|
||||
|
@ -63,7 +63,7 @@ enum gr_face_options {
|
||||
/** Cache the lookup from code point to glyph ID at construction time */
|
||||
gr_face_cacheCmap = 4,
|
||||
/** Preload everything */
|
||||
gr_face_preloadAll = 6
|
||||
gr_face_preloadAll = gr_face_preloadGlyphs | gr_face_cacheCmap
|
||||
};
|
||||
|
||||
/** Holds information about a particular Graphite silf table that has been loaded */
|
||||
|
@ -155,12 +155,21 @@ GR2_API unsigned int gr_cinfo_unicode_char(const gr_char_info* p/*not NULL*/);
|
||||
/** Returns breakweight for a charinfo.
|
||||
*
|
||||
* @return Breakweight is a number between -50 and 50 indicating the cost of a
|
||||
* break before or after this character.
|
||||
* break before or after this character. If the value < 0, the absolute value
|
||||
* is this character's contribution to the overall breakweight before it. If the value
|
||||
* > 0, then the value is this character's contribution to the overall breakweight after it.
|
||||
* The overall breakweight between two characters is the maximum of the breakweight
|
||||
* contributions from the characters either side of it. If a character makes no
|
||||
* contribution to the breakweight on one side of it, the contribution is considered
|
||||
* to be 0.
|
||||
* @param p Pointer to charinfo to return information on.
|
||||
*/
|
||||
GR2_API int gr_cinfo_break_weight(const gr_char_info* p/*not NULL*/);
|
||||
|
||||
/** Returns the slot index that after this character is after in the slot stream
|
||||
*
|
||||
* In effect each character is associated with a set of slots and this returns
|
||||
* the index of the last slot in the segment this character is associated with.
|
||||
*
|
||||
* @return after slot index between 0 and gr_seg_n_slots()
|
||||
* @param p Pointer to charinfo to return information on.
|
||||
@ -168,6 +177,9 @@ GR2_API int gr_cinfo_break_weight(const gr_char_info* p/*not NULL*/);
|
||||
GR2_API int gr_cinfo_after(const gr_char_info* p/*not NULL*/);
|
||||
|
||||
/** Returns the slot index that before this character is before in the slot stream
|
||||
*
|
||||
* In effect each character is associated with a set of slots and this returns
|
||||
* the index of the first slot in the segment this character is associated with.
|
||||
*
|
||||
* @return before slot index between 0 and gr_seg_n_slots()
|
||||
* @param p Pointer to charinfo to return information on.
|
||||
@ -340,34 +352,42 @@ GR2_API float gr_slot_origin_Y(const gr_slot* p);
|
||||
*
|
||||
* @param p Slot to give results for
|
||||
* @param face gr_face of the glyphs. May be NULL if unhinted advances used
|
||||
* @param font gr_font to scale for pixel results. If NULL returns design units advance. If not NULL then returns pixel advance based on hinted or scaled glyph advances in the font. face must be passed for hinted advances to be used.
|
||||
* @param font gr_font to scale for pixel results. If NULL returns design
|
||||
* units advance. If not NULL then returns pixel advance based
|
||||
* on hinted or scaled glyph advances in the font. face must be
|
||||
* passed for hinted advances to be used.
|
||||
*/
|
||||
GR2_API float gr_slot_advance_X(const gr_slot* p, const gr_face* face, const gr_font *font);
|
||||
|
||||
/** Returns the vertical advance for the glyph in the slot adjusted for kerning
|
||||
*
|
||||
* Returns design units unless font is not NULL in which case the pixel value is returned scaled for the given font
|
||||
* Returns design units unless font is not NULL in which case the pixel value
|
||||
* is returned scaled for the given font
|
||||
*/
|
||||
GR2_API float gr_slot_advance_Y(const gr_slot* p, const gr_face* face, const gr_font *font);
|
||||
|
||||
/** Returns the gr_char_info index before us
|
||||
*
|
||||
* Returns the index of the gr_char_info that a cursor before this slot, would put
|
||||
* an underlying cursor before.
|
||||
* an underlying cursor before. This may also be interpretted as each slot holding
|
||||
* a set of char_infos that it is associated with and this function returning the
|
||||
* index of the char_info with lowest index, from this set.
|
||||
*/
|
||||
GR2_API int gr_slot_before(const gr_slot* p/*not NULL*/);
|
||||
|
||||
/** Returns the gr_char_info index after us
|
||||
*
|
||||
* Returns the index of the gr_char_info that a cursor after this slot would put an
|
||||
* underlying cursor after.
|
||||
* underlying cursor after. This may also be interpretted as each slot holding a set
|
||||
* of char_infos that it is associated with and this function returning the index of
|
||||
* the char_info with the highest index, from this set.
|
||||
*/
|
||||
GR2_API int gr_slot_after(const gr_slot* p/*not NULL*/);
|
||||
|
||||
/** Returns the index of this slot in the segment
|
||||
*
|
||||
* Returns the index given to this slot during final positioning. This corresponds to the value returned br gr_cinfo_before()
|
||||
* and gr_cinfo_after()
|
||||
* Returns the index given to this slot during final positioning. This corresponds
|
||||
* to the value returned br gr_cinfo_before() and gr_cinfo_after()
|
||||
*/
|
||||
GR2_API unsigned int gr_slot_index(const gr_slot* p/*not NULL*/);
|
||||
|
||||
@ -383,8 +403,8 @@ GR2_API int gr_slot_can_insert_before(const gr_slot* p);
|
||||
|
||||
/** Returns the original gr_char_info index this slot refers to.
|
||||
*
|
||||
* Each Slot has a gr_char_info that it originates from. This is that gr_char_info. The index is passed to gr_seg_cinfo(). This
|
||||
* information is useful for testing.
|
||||
* Each Slot has a gr_char_info that it originates from. This is that gr_char_info.
|
||||
* The index is passed to gr_seg_cinfo(). This information is useful for testing.
|
||||
*/
|
||||
GR2_API int gr_slot_original(const gr_slot* p/*not NULL*/);
|
||||
|
||||
|
35
gfx/graphite2/moz-gr-update.sh
Normal file
35
gfx/graphite2/moz-gr-update.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script used to update the Graphite2 library in the mozilla source tree
|
||||
|
||||
# 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!
|
||||
|
||||
# copy the source and headers
|
||||
cp -R ../graphitedev/src/* gfx/graphite2/src
|
||||
cp ../graphitedev/include/graphite2/* gfx/graphite2/include/graphite2
|
||||
|
||||
# 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
|
||||
|
||||
# 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/;" {} \;
|
||||
|
||||
# summarize what's been touched
|
||||
echo Updated to $CHANGESET.
|
||||
echo Here is what changed in the gfx/graphite2 directory:
|
||||
echo
|
||||
|
||||
hg stat gfx/graphite2
|
||||
|
||||
echo
|
||||
echo Now use hg commands to create a patch for the mozilla tree.
|
||||
echo
|
@ -103,7 +103,7 @@ set_target_properties(graphite2 PROPERTIES PUBLIC_HEADER "${GRAPHITE_HEADERS}"
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set_target_properties(graphite2 PROPERTIES
|
||||
COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wctor-dtor-privacy -Wnon-virtual-dtor -fdiagnostics-show-option -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-stack-protector"
|
||||
COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wctor-dtor-privacy -Wnon-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-stack-protector"
|
||||
LINK_FLAGS "-nodefaultlibs"
|
||||
LINKER_LANGUAGE C)
|
||||
if (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*")
|
||||
@ -119,7 +119,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 -fdiagnostics-show-option -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-stack-protector"
|
||||
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"
|
||||
LINK_FLAGS "-nodefaultlibs"
|
||||
LINKER_LANGUAGE C)
|
||||
target_link_libraries(graphite2 c)
|
||||
|
@ -182,13 +182,6 @@ const GlyphFace *GlyphCache::glyph(unsigned short glyphid) const //result m
|
||||
return p;
|
||||
}
|
||||
|
||||
uint16 GlyphCache::glyphAttr(uint16 gid, uint16 gattr) const
|
||||
{
|
||||
const GlyphFace * p = glyphSafe(gid);
|
||||
|
||||
return p && gattr < p->attrs().size() ? p->attrs()[gattr] : 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GlyphCache::Loader::Loader(const Face & face, const bool dumb_font)
|
||||
@ -311,7 +304,7 @@ const GlyphFace * GlyphCache::Loader::read_glyph(unsigned short glyphid, GlyphFa
|
||||
gloce = be::peek<uint16>(gloc);
|
||||
}
|
||||
|
||||
if (glocs >= m_pGlat.size() && gloce > m_pGlat.size())
|
||||
if (glocs >= m_pGlat.size() || gloce > m_pGlat.size())
|
||||
return 0;
|
||||
|
||||
const uint32 glat_version = be::peek<uint32>(m_pGlat);
|
||||
|
@ -139,14 +139,7 @@ void Segment::appendSlot(int id, int cid, int gid, int iFeats, size_t coffset)
|
||||
m_charinfo[id].feats(iFeats);
|
||||
m_charinfo[id].base(coffset);
|
||||
const GlyphFace * theGlyph = m_face->glyphs().glyphSafe(gid);
|
||||
if (theGlyph)
|
||||
{
|
||||
m_charinfo[id].breakWeight(theGlyph->attrs()[m_silf->aBreak()]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_charinfo[id].breakWeight(0);
|
||||
}
|
||||
m_charinfo[id].breakWeight(theGlyph ? theGlyph->attrs()[m_silf->aBreak()] : 0);
|
||||
|
||||
aSlot->child(NULL);
|
||||
aSlot->setGlyph(this, gid, theGlyph);
|
||||
|
@ -133,8 +133,8 @@ bool Silf::readGraphite(const byte * const silf_start, size_t lSilf, const Face&
|
||||
be::skip<byte>(p); // reserved
|
||||
if (p >= silf_end) { releaseBuffers(); return false; }
|
||||
be::skip<uint32>(p, be::read<uint8>(p)); // don't use scriptTag array.
|
||||
if (p + sizeof(uint16) + sizeof(uint32) >= silf_end) { releaseBuffers(); return false; }
|
||||
m_gEndLine = be::read<uint16>(p); // lbGID
|
||||
if (p >= silf_end) { releaseBuffers(); return false; }
|
||||
const byte * o_passes = p,
|
||||
* const passes_start = silf_start + be::read<uint32>(p);
|
||||
|
||||
|
@ -39,9 +39,10 @@ sparse::~sparse() throw()
|
||||
|
||||
sparse::mapped_type sparse::operator [] (const key_type k) const throw()
|
||||
{
|
||||
const chunk & c = m_array.map[k/SIZEOF_CHUNK];
|
||||
mapped_type g = key_type(k/SIZEOF_CHUNK - m_nchunks) >> (sizeof k*8 - 1);
|
||||
const chunk & c = m_array.map[g*k/SIZEOF_CHUNK];
|
||||
const mask_t m = c.mask >> (SIZEOF_CHUNK - 1 - (k%SIZEOF_CHUNK));
|
||||
const mapped_type g = m & 1;
|
||||
g *= m & 1;
|
||||
|
||||
return g*m_array.values[g*(c.offset + bit_set_count(m >> 1))];
|
||||
}
|
||||
|
@ -709,10 +709,8 @@ int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp,
|
||||
if (be::swap(pTable2->glyph_name_index[nGlyphId]) == iPostName)
|
||||
return nGlyphId;
|
||||
}
|
||||
return -1; // no glyph with this standard name
|
||||
}
|
||||
|
||||
else
|
||||
{ // did not match a standard name, search font specific names
|
||||
size_t nStrSizeGoal = strlen(pPostName);
|
||||
const char * pFirstGlyphName = reinterpret_cast<const char *>(
|
||||
|
@ -32,7 +32,7 @@ of the License or (at your option) any later version.
|
||||
|
||||
#ifndef GRAPHITE2_NFILEFACE
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
#include <cassert>
|
||||
|
||||
#include "graphite2/Font.h"
|
||||
|
@ -54,7 +54,6 @@ public:
|
||||
|
||||
const GlyphFace *glyph(unsigned short glyphid) const; //result may be changed by subsequent call with a different glyphid
|
||||
const GlyphFace *glyphSafe(unsigned short glyphid) const;
|
||||
uint16 glyphAttr(uint16 gid, uint16 gattr) const;
|
||||
|
||||
CLASS_NEW_DELETE;
|
||||
|
||||
|
@ -56,7 +56,6 @@ private:
|
||||
int doAction(const vm::Machine::Code* codeptr, Slot * & slot_out, vm::Machine &) const;
|
||||
bool testPassConstraint(vm::Machine & m) const;
|
||||
bool testConstraint(const Rule & r, vm::Machine &) const;
|
||||
bool readFSM(const byte* p, const byte*const pass_start, const size_t max_offset);
|
||||
bool readRules(const byte * rule_map, const size_t num_entries,
|
||||
const byte *precontext, const uint16 * sort_key,
|
||||
const uint16 * o_constraint, const byte *constraint_data,
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
int addFeatures(const Features& feats) { m_feats.push_back(feats); return m_feats.size() - 1; }
|
||||
uint32 getFeature(int index, uint8 findex) const { const FeatureRef* pFR=m_face->theSill().theFeatureMap().featureRef(findex); if (!pFR) return 0; else return pFR->getFeatureVal(m_feats[index]); }
|
||||
void dir(int8 val) { m_dir = val; }
|
||||
uint16 glyphAttr(uint16 gid, uint16 gattr) const { return m_face->glyphs().glyphAttr(gid, gattr); }
|
||||
uint16 glyphAttr(uint16 gid, uint16 gattr) const { const GlyphFace * p = m_face->glyphs().glyphSafe(gid); return p ? p->attrs()[gattr] : 0; }
|
||||
uint16 getGlyphMetric(Slot *iSlot, uint8 metric, uint8 attrLevel) const;
|
||||
float glyphAdvance(uint16 gid) const { return m_face->glyphs().glyph(gid)->theAdvance().x; }
|
||||
const Rect &theGlyphBBoxTemporary(uint16 gid) const { return m_face->glyphs().glyph(gid)->theBBox(); } //warning value may become invalid when another glyph is accessed
|
||||
|
Loading…
Reference in New Issue
Block a user