src/share/native/sun/font/layout/KernTable.cpp

Print this page
rev 8822 : 8024854: PPC64: Basic changes and files to build the class library on AIX
Reviewed-by: alanb, prr, sla, chegar, michaelm, mullan, art
Contributed-by: luchsh@linux.vnet.ibm.com, spoole@linux.vnet.ibm.com, thomas.stuefe@sap.com

*** 37,47 **** #include "LESwaps.h" #include "OpenTypeUtilities.h" #include <stdio.h> ! #define DEBUG 0 U_NAMESPACE_BEGIN struct PairInfo { le_uint32 key; // sigh, MSVC compiler gags on union here --- 37,47 ---- #include "LESwaps.h" #include "OpenTypeUtilities.h" #include <stdio.h> ! #define DEBUG_KERN_TABLE 0 U_NAMESPACE_BEGIN struct PairInfo { le_uint32 key; // sigh, MSVC compiler gags on union here
*** 97,114 **** */ KernTable::KernTable(const LETableReference& base, LEErrorCode &success) : pairsSwapped(NULL), fTable(base) { if(LE_FAILURE(success) || (fTable.isEmpty())) { ! #if DEBUG fprintf(stderr, "no kern data\n"); #endif return; } LEReferenceTo<KernTableHeader> header(fTable, success); ! #if DEBUG // dump first 32 bytes of header for (int i = 0; i < 64; ++i) { fprintf(stderr, "%0.2x ", ((const char*)header.getAlias())[i]&0xff); if (((i+1)&0xf) == 0) { fprintf(stderr, "\n"); --- 97,114 ---- */ KernTable::KernTable(const LETableReference& base, LEErrorCode &success) : pairsSwapped(NULL), fTable(base) { if(LE_FAILURE(success) || (fTable.isEmpty())) { ! #if DEBUG_KERN_TABLE fprintf(stderr, "no kern data\n"); #endif return; } LEReferenceTo<KernTableHeader> header(fTable, success); ! #if DEBUG_KERN_TABLE // dump first 32 bytes of header for (int i = 0; i < 64; ++i) { fprintf(stderr, "%0.2x ", ((const char*)header.getAlias())[i]&0xff); if (((i+1)&0xf) == 0) { fprintf(stderr, "\n");
*** 169,179 **** #if 0 fprintf(stderr, "coverage: %0.4x nPairs: %d pairs %p\n", coverage, nPairs, pairsSwapped); fprintf(stderr, " searchRange: %d entrySelector: %d rangeShift: %d\n", searchRange, entrySelector, rangeShift); fprintf(stderr, "[[ ignored font table entries: range %d selector %d shift %d ]]\n", SWAPW(table->searchRange), SWAPW(table->entrySelector), SWAPW(table->rangeShift)); #endif ! #if DEBUG fprintf(stderr, "coverage: %0.4x nPairs: %d pairs 0x%x\n", coverage, nPairs, pairsSwapped); fprintf(stderr, " searchRange(pairs): %d entrySelector: %d rangeShift(pairs): %d\n", searchRange, entrySelector, rangeShift); --- 169,179 ---- #if 0 fprintf(stderr, "coverage: %0.4x nPairs: %d pairs %p\n", coverage, nPairs, pairsSwapped); fprintf(stderr, " searchRange: %d entrySelector: %d rangeShift: %d\n", searchRange, entrySelector, rangeShift); fprintf(stderr, "[[ ignored font table entries: range %d selector %d shift %d ]]\n", SWAPW(table->searchRange), SWAPW(table->entrySelector), SWAPW(table->rangeShift)); #endif ! #if DEBUG_KERN_TABLE fprintf(stderr, "coverage: %0.4x nPairs: %d pairs 0x%x\n", coverage, nPairs, pairsSwapped); fprintf(stderr, " searchRange(pairs): %d entrySelector: %d rangeShift(pairs): %d\n", searchRange, entrySelector, rangeShift);
*** 240,265 **** const PairInfo* tp = (const PairInfo*)(p + (rangeShift/KERN_PAIRINFO_SIZE)); /* rangeshift is in original table bytes */ if (key > tp->key) { p = tp; } ! #if DEBUG fprintf(stderr, "binary search for %0.8x\n", key); #endif le_uint32 probe = searchRange; while (probe > 1) { probe >>= 1; tp = (const PairInfo*)(p + (probe/KERN_PAIRINFO_SIZE)); le_uint32 tkey = tp->key; ! #if DEBUG fprintf(stdout, " %.3d (%0.8x)\n", (tp - pairsSwapped), tkey); #endif if (tkey <= key) { if (tkey == key) { le_int16 value = SWAPW(tp->value); ! #if DEBUG fprintf(stdout, "binary found kerning pair %x:%x at %d, value: 0x%x (%g)\n", storage[i-1], storage[i], i, value & 0xffff, font->xUnitsToPoints(value)); fflush(stdout); #endif // Have to undo the device transform. --- 240,265 ---- const PairInfo* tp = (const PairInfo*)(p + (rangeShift/KERN_PAIRINFO_SIZE)); /* rangeshift is in original table bytes */ if (key > tp->key) { p = tp; } ! #if DEBUG_KERN_TABLE fprintf(stderr, "binary search for %0.8x\n", key); #endif le_uint32 probe = searchRange; while (probe > 1) { probe >>= 1; tp = (const PairInfo*)(p + (probe/KERN_PAIRINFO_SIZE)); le_uint32 tkey = tp->key; ! #if DEBUG_KERN_TABLE fprintf(stdout, " %.3d (%0.8x)\n", (tp - pairsSwapped), tkey); #endif if (tkey <= key) { if (tkey == key) { le_int16 value = SWAPW(tp->value); ! #if DEBUG_KERN_TABLE fprintf(stdout, "binary found kerning pair %x:%x at %d, value: 0x%x (%g)\n", storage[i-1], storage[i], i, value & 0xffff, font->xUnitsToPoints(value)); fflush(stdout); #endif // Have to undo the device transform.