1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ******************************************************************************* 3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Copyright (C) 1999-2008, International Business Machines 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Corporation and others. All Rights Reserved. 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ******************************************************************************* 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * file name: PortableFontInstance.cpp 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * created on: 11/22/1999 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * created by: Eric R. Mader 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include <stdio.h> 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "layout/LETypes.h" 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "layout/LEFontInstance.h" 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "layout/LESwaps.h" 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "PortableFontInstance.h" 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "letest.h" 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "sfnt.h" 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include <string.h> 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// Finds the high bit by binary searching 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// through the bits in n. 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_int8 PortableFontInstance::highBit(le_int32 value) 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (value <= 0) { 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return -32; 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_uint8 bit = 0; 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (value >= 1 << 16) { 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru value >>= 16; 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru bit += 16; 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (value >= 1 << 8) { 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru value >>= 8; 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru bit += 8; 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (value >= 1 << 4) { 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru value >>= 4; 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru bit += 4; 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (value >= 1 << 2) { 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru value >>= 2; 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru bit += 2; 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (value >= 1 << 1) { 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru value >>= 1; 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru bit += 1; 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return bit; 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruPortableFontInstance::PortableFontInstance(const char *fileName, float pointSize, LEErrorCode &status) 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : fFile(NULL), fPointSize(pointSize), fUnitsPerEM(0), fFontChecksum(0), fAscent(0), fDescent(0), fLeading(0), 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fDirectory(NULL), fNAMETable(NULL), fNameCount(0), fNameStringOffset(0), fCMAPMapper(NULL), fHMTXTable(NULL), fNumGlyphs(0), fNumLongHorMetrics(0) 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (LE_FAILURE(status)) { 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // open the font file 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fFile = fopen(fileName, "rb"); 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (fFile == NULL) { 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru status = LE_FONT_FILE_NOT_FOUND_ERROR; 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // read in the directory 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru SFNTDirectory tempDir; 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fread(&tempDir, sizeof tempDir, 1, fFile); 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_int32 dirSize = sizeof tempDir + ((SWAPW(tempDir.numTables) - ANY_NUMBER) * sizeof(DirectoryEntry)); 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const LETag headTag = LE_HEAD_TABLE_TAG; 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const LETag hheaTag = LE_HHEA_TABLE_TAG; 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const HEADTable *headTable = NULL; 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const HHEATable *hheaTable = NULL; 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// const NAMETable *nameTable = NULL; 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_uint16 numTables = 0; 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fDirectory = (const SFNTDirectory *) NEW_ARRAY(char, dirSize); 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (fDirectory == NULL) { 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru status = LE_MEMORY_ALLOCATION_ERROR; 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru goto error_exit; 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fseek(fFile, 0L, SEEK_SET); 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fread((void *) fDirectory, sizeof(char), dirSize, fFile); 105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // We calculate these numbers 'cause some fonts 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // have bogus values for them in the directory header. 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru numTables = SWAPW(fDirectory->numTables); 111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fDirPower = 1 << highBit(numTables); 112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fDirExtra = numTables - fDirPower; 113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // read unitsPerEm from 'head' table 115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru headTable = (const HEADTable *) readFontTable(headTag); 116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (headTable == NULL) { 118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru status = LE_MISSING_FONT_TABLE_ERROR; 119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru goto error_exit; 120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fUnitsPerEM = SWAPW(headTable->unitsPerEm); 123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fFontChecksum = SWAPL(headTable->checksumAdjustment); 12485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho freeFontTable(headTable); 125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //nameTable = (NAMETable *) readFontTable(nameTag); 127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //if (nameTable == NULL) { 129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // status = LE_MISSING_FONT_TABLE_ERROR; 130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // goto error_exit; 131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //} 132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //fFontVersionString = findName(nameTable, NAME_VERSION_STRING, PLATFORM_MACINTOSH, MACINTOSH_ROMAN, MACINTOSH_ENGLISH); 134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //if (fFontVersionString == NULL) { 136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // status = LE_MISSING_FONT_TABLE_ERROR; 137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // goto error_exit; 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //} 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 14085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho //freeFontTable(nameTable); 141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru hheaTable = (HHEATable *) readFontTable(hheaTag); 143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (hheaTable == NULL) { 145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru status = LE_MISSING_FONT_TABLE_ERROR; 146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru goto error_exit; 147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fAscent = (le_int32) yUnitsToPoints((float) SWAPW(hheaTable->ascent)); 150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fDescent = (le_int32) yUnitsToPoints((float) SWAPW(hheaTable->descent)); 151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fLeading = (le_int32) yUnitsToPoints((float) SWAPW(hheaTable->lineGap)); 152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fNumLongHorMetrics = SWAPW(hheaTable->numOfLongHorMetrics); 154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 15585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho freeFontTable((void *) hheaTable); 156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fCMAPMapper = findUnicodeMapper(); 158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (fCMAPMapper == NULL) { 160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru status = LE_MISSING_FONT_TABLE_ERROR; 161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru goto error_exit; 162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruerror_exit: 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fclose(fFile); 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fFile = NULL; 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruPortableFontInstance::~PortableFontInstance() 173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (fFile != NULL) { 175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fclose(fFile); 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 17785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho freeFontTable(fHMTXTable); 17885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho freeFontTable(fNAMETable); 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru delete fCMAPMapper; 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DELETE_ARRAY(fDirectory); 183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst DirectoryEntry *PortableFontInstance::findTable(LETag tag) const 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (fDirectory != NULL) { 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_uint16 table = 0; 190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_uint16 probe = fDirPower; 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (SWAPL(fDirectory->tableDirectory[fDirExtra].tag) <= tag) { 193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru table = fDirExtra; 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru while (probe > (1 << 0)) { 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru probe >>= 1; 198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (SWAPL(fDirectory->tableDirectory[table + probe].tag) <= tag) { 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru table += probe; 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (SWAPL(fDirectory->tableDirectory[table].tag) == tag) { 205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return &fDirectory->tableDirectory[table]; 206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return NULL; 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst void *PortableFontInstance::readTable(LETag tag, le_uint32 *length) const 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const DirectoryEntry *entry = findTable(tag); 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (entry == NULL) { 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *length = 0; 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return NULL; 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *length = SWAPL(entry->length); 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void *table = NEW_ARRAY(char, *length); 224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (table != NULL) { 226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fseek(fFile, SWAPL(entry->offset), SEEK_SET); 227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fread(table, sizeof(char), *length, fFile); 228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return table; 231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst void *PortableFontInstance::getFontTable(LETag tableTag) const 234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return FontTableCache::find(tableTag); 236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst void *PortableFontInstance::readFontTable(LETag tableTag) const 239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_uint32 len; 241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return readTable(tableTag, &len); 243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruCMAPMapper *PortableFontInstance::findUnicodeMapper() 246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru LETag cmapTag = LE_CMAP_TABLE_TAG; 248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const CMAPTable *cmap = (CMAPTable *) readFontTable(cmapTag); 249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (cmap == NULL) { 251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return NULL; 252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return CMAPMapper::createUnicodeMapper(cmap); 255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst char *PortableFontInstance::getNameString(le_uint16 nameID, le_uint16 platformID, le_uint16 encodingID, le_uint16 languageID) const 258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (fNAMETable == NULL) { 260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru LETag nameTag = LE_NAME_TABLE_TAG; 261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru PortableFontInstance *realThis = (PortableFontInstance *) this; 262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru realThis->fNAMETable = (const NAMETable *) readFontTable(nameTag); 264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (realThis->fNAMETable != NULL) { 266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru realThis->fNameCount = SWAPW(realThis->fNAMETable->count); 267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru realThis->fNameStringOffset = SWAPW(realThis->fNAMETable->stringOffset); 268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for(le_int32 i = 0; i < fNameCount; i += 1) { 272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const NameRecord *nameRecord = &fNAMETable->nameRecords[i]; 273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 27485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho if (SWAPW(nameRecord->platformID) == platformID && SWAPW(nameRecord->encodingID) == encodingID && 275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru SWAPW(nameRecord->languageID) == languageID && SWAPW(nameRecord->nameID) == nameID) { 276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru char *name = ((char *) fNAMETable) + fNameStringOffset + SWAPW(nameRecord->offset); 277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_uint16 length = SWAPW(nameRecord->length); 278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru char *result = NEW_ARRAY(char, length + 2); 279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ARRAY_COPY(result, name, length); 281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru result[length] = result[length + 1] = 0; 282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return result; 284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return NULL; 288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 29085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hoconst LEUnicode16 *PortableFontInstance::getUnicodeNameString(le_uint16 nameID, le_uint16 platformID, le_uint16 encodingID, le_uint16 languageID) const 29185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho{ 29285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho if (fNAMETable == NULL) { 29385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho LETag nameTag = LE_NAME_TABLE_TAG; 29485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho PortableFontInstance *realThis = (PortableFontInstance *) this; 29585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 29685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho realThis->fNAMETable = (const NAMETable *) readFontTable(nameTag); 29785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 29885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho if (realThis->fNAMETable != NULL) { 29985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho realThis->fNameCount = SWAPW(realThis->fNAMETable->count); 30085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho realThis->fNameStringOffset = SWAPW(realThis->fNAMETable->stringOffset); 30185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } 30285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } 30385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 30485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho for(le_int32 i = 0; i < fNameCount; i += 1) { 30585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const NameRecord *nameRecord = &fNAMETable->nameRecords[i]; 30685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 30785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho if (SWAPW(nameRecord->platformID) == platformID && SWAPW(nameRecord->encodingID) == encodingID && 30885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho SWAPW(nameRecord->languageID) == languageID && SWAPW(nameRecord->nameID) == nameID) { 30985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho LEUnicode16 *name = (LEUnicode16 *) (((char *) fNAMETable) + fNameStringOffset + SWAPW(nameRecord->offset)); 31085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho le_uint16 length = SWAPW(nameRecord->length) / 2; 31185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho LEUnicode16 *result = NEW_ARRAY(LEUnicode16, length + 2); 31285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 31385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho for (le_int32 c = 0; c < length; c += 1) { 31485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho result[c] = SWAPW(name[c]); 31585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } 31685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 31785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho result[length] = 0; 31885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 31985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho return result; 32085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } 32185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } 32285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 32385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho return NULL; 32485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho} 32585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruvoid PortableFontInstance::deleteNameString(const char *name) const 327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DELETE_ARRAY(name); 329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 33185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hovoid PortableFontInstance::deleteNameString(const LEUnicode16 *name) const 33285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho{ 33385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho DELETE_ARRAY(name); 33485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho} 33585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruvoid PortableFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const 337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyph); 339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (fHMTXTable == NULL) { 341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru LETag maxpTag = LE_MAXP_TABLE_TAG; 342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru LETag hmtxTag = LE_HMTX_TABLE_TAG; 343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const MAXPTable *maxpTable = (MAXPTable *) readFontTable(maxpTag); 344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru PortableFontInstance *realThis = (PortableFontInstance *) this; 345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (maxpTable != NULL) { 347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru realThis->fNumGlyphs = SWAPW(maxpTable->numGlyphs); 34885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho freeFontTable(maxpTable); 349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru realThis->fHMTXTable = (const HMTXTable *) readFontTable(hmtxTag); 352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_uint16 index = ttGlyph; 355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (ttGlyph >= fNumGlyphs || fHMTXTable == NULL) { 357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru advance.fX = advance.fY = 0; 358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (ttGlyph >= fNumLongHorMetrics) { 362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru index = fNumLongHorMetrics - 1; 363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru advance.fX = xUnitsToPoints(SWAPW(fHMTXTable->hMetrics[index].advanceWidth)); 366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru advance.fY = 0; 367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_bool PortableFontInstance::getGlyphPoint(LEGlyphID /*glyph*/, le_int32 /*pointNumber*/, LEPoint &/*point*/) const 370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return FALSE; 372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_int32 PortableFontInstance::getUnitsPerEM() const 375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fUnitsPerEM; 377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_uint32 PortableFontInstance::getFontChecksum() const 380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fFontChecksum; 382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_int32 PortableFontInstance::getAscent() const 385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fAscent; 387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_int32 PortableFontInstance::getDescent() const 390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fDescent; 392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_int32 PortableFontInstance::getLeading() const 395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fLeading; 397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// We really want to inherit this method from the superclass, but some compilers 400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// issue a warning if we don't implement it... 401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLEGlyphID PortableFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const 402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return LEFontInstance::mapCharToGlyph(ch, mapper, filterZeroWidth); 404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// We really want to inherit this method from the superclass, but some compilers 407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// issue a warning if we don't implement it... 408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLEGlyphID PortableFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const 409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return LEFontInstance::mapCharToGlyph(ch, mapper); 411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLEGlyphID PortableFontInstance::mapCharToGlyph(LEUnicode32 ch) const 414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fCMAPMapper->unicodeToGlyph(ch); 416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querufloat PortableFontInstance::getXPixelsPerEm() const 419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fPointSize; 421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querufloat PortableFontInstance::getYPixelsPerEm() const 424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fPointSize; 426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querufloat PortableFontInstance::getScaleFactorX() const 429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return 1.0; 431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querufloat PortableFontInstance::getScaleFactorY() const 434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return 1.0; 436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 437