/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* remember that the API requires a Font use a
* consistent glyph id. for a code point, and this is a
* problem if a particular strike uses native scaler sometimes
* and T2K others. That needs to be dealt with somewhere, but
* here we can just always get the same glyph code without
* needing a strike.
*
* The C implementation would cache the results of anything up
* to the maximum surrogate pair code point.
* This implementation will not cache as much, since the storage
* requirements are not justifiable. Even so it still can use up
* to 216*256*4 bytes of storage per composite font. If an app
* calls canDisplay on this range for all 20 composite fonts that's
* over 1Mb of cached data. May need to employ WeakReferences if
* this appears to cause problems.
*/
int[][] glyphMaps;
private boolean hasExcludes;
initMapper();
/* This is often false which saves the overhead of a
* per-mapped char method call.
*/
}
}
private final void initMapper() {
}
/* This requires that slot 0 is never empty. */
}
}
if (unicode >= MAXUNICODE) {
return UNINITIALIZED_GLYPH; // don't cache surrogates
}
int[] gmap;
return UNINITIALIZED_GLYPH;
}
}
if (unicode >= MAXUNICODE) {
return; // don't cache surrogates
}
for (int i=0;i<BLOCKSZ;i++) {
}
}
}
}
return mapper;
}
return glyphCode;
}
}
}
return missingGlyph;
}
public int getNumGlyphs() {
int numGlyphs = 0;
/* The number of glyphs in a composite is affected by
* exclusion ranges and duplicates (ie the same code point is
* mapped by two different fonts) and also whether or not to
* count fallback fonts. A nearly correct answer would be very
* expensive to generate. A rough ballpark answer would
* just count the glyphs in all the slots. However this would
* initialize mappers for all slots when they aren't necessarily
* needed. For now just use the first slot as JDK 1.4 did.
*/
}
}
return numGlyphs;
}
if (glyphCode == UNINITIALIZED_GLYPH) {
}
return glyphCode;
}
if (prefSlot >= 0) {
}
}
return charToGlyph(unicode);
}
if (glyphCode == UNINITIALIZED_GLYPH) {
}
return glyphCode;
}
/* This variant checks if shaping is needed and immediately
* returns true if it does. A caller of this method should be expecting
* to check the return type because it needs to know how to handle
* the character data for display.
*/
for (int i=0; i<count; i++) {
if (code >= HI_SURROGATE_START &&
if (low >= LO_SURROGATE_START &&
low <= LO_SURROGATE_END) {
}
}
if (gc == UNINITIALIZED_GLYPH) {
}
continue;
}
return true;
}
else if (code >= 0x10000) {
i += 1; // Empty glyph slot after surrogate
continue;
}
}
return false;
}
/* The conversion is not very efficient - looping as it does, converting
* one char at a time. However the cache should fill very rapidly.
*/
for (int i=0; i<count; i++) {
if (code >= HI_SURROGATE_START &&
if (low >= LO_SURROGATE_START &&
low <= LO_SURROGATE_END) {
if (gc == UNINITIALIZED_GLYPH) {
}
i += 1; // Empty glyph slot after surrogate
glyphs[i] = INVISIBLE_GLYPH_ID;
continue;
}
}
if (gc == UNINITIALIZED_GLYPH) {
}
}
}
for (int i=0; i<count; i++) {
if (glyphs[i] == UNINITIALIZED_GLYPH) {
}
}
}
}