1464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com/* 2464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * Copyright 2011 Google Inc. All Rights Reserved. 3464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * 4464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * Licensed under the Apache License, Version 2.0 (the "License"); 5464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * you may not use this file except in compliance with the License. 6464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * You may obtain a copy of the License at 7464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * 8464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * http://www.apache.org/licenses/LICENSE-2.0 9464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * 10464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * Unless required by applicable law or agreed to in writing, software 11464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * distributed under the License is distributed on an "AS IS" BASIS, 12464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * See the License for the specific language governing permissions and 14464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * limitations under the License. 15464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com */ 16464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 175af34fd773f8cfee82321393504f558ddf67c628arthurhsu@google.com#ifndef SFNTLY_CPP_SRC_SFNTLY_TABLE_CORE_NAME_TABLE_H_ 185af34fd773f8cfee82321393504f558ddf67c628arthurhsu@google.com#define SFNTLY_CPP_SRC_SFNTLY_TABLE_CORE_NAME_TABLE_H_ 19464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 20090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com// Must include this before ICU to avoid stdint redefinition issue. 21090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com#include "sfntly/port/type.h" 22090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 23090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com#include <unicode/ucnv.h> 24090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com#include <unicode/ustring.h> 25090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 26464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com#include <map> 27464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com#include <utility> 28464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 29333edd91cb32d6acfd0307ba2ae8f60baed75ff4arthurhsu@google.com#include "sfntly/port/java_iterator.h" 30b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com#include "sfntly/table/subtable_container_table.h" 31464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 32464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comnamespace sfntly { 33464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 34246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com// The following code implements the name table defined in TTF/OTF spec, which 35246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com// can be found at http://www.microsoft.com/typography/otspec/name.htm. 36246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 37246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com// Name IDs defined in TTF/OTF spec. 3844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.comstruct NameId { 3944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com enum { 4044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUnknown = -1, 4144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCopyrightNotice = 0, 4244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFontFamilyName = 1, 4344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFontSubfamilyName = 2, 4444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUniqueFontIdentifier = 3, 4544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFullFontName = 4, 4644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kVersionString = 5, 4744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPostscriptName = 6, 4844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTrademark = 7, 4944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kManufacturerName = 8, 5044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDesigner = 9, 5144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDescription = 10, 5244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kVendorURL = 11, 5344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDesignerURL = 12, 5444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLicenseDescription = 13, 5544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLicenseInfoURL = 14, 5644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kReserved15 = 15, 5744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPreferredFamily = 16, 5844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPreferredSubfamily = 17, 5944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCompatibleFullName = 18, 6044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSampleText = 19, 6144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPostscriptCID = 20, 6244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kWWSFamilyName = 21, 6344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kWWSSubfamilyName = 22 6444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com }; 6544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com}; 6644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com 67246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com// Unicode language IDs used in Name Records. 68464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comstruct UnicodeLanguageId { 6944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com enum { 7044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUnknown = -1, 7144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAll = 0 7244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com }; 73464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com}; 74464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 7544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com// Macintosh Language IDs (platform ID = 1) 76464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comstruct MacintoshLanguageId { 7744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com enum { 7844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUnknown = -1, 7944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish = 0, 8044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFrench = 1, 8144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGerman = 2, 8244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kItalian = 3, 8344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDutch = 4, 8444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSwedish = 5, 8544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish = 6, 8644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDanish = 7, 8744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPortuguese = 8, 8844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kNorwegian = 9, 8944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kHebrew = 10, 9044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kJapanese = 11, 9144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic = 12, 9244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFinnish = 13, 9344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGreek = 14, 9444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kIcelandic = 15, 9544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMaltese = 16, 9644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTurkish = 17, 9744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCroatian = 18, 9844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kChinese_Traditional = 19, 9944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUrdu = 20, 10044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kHindi = 21, 10144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kThai = 22, 10244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKorean = 23, 10344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLithuanian = 24, 10444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPolish = 25, 10544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kHungarian = 26, 10644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEstonian = 27, 10744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLatvian = 28, 10844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSami = 29, 10944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFaroese = 30, 11044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFarsiPersian = 31, 11144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kRussian = 32, 11244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kChinese_Simplified = 33, 11344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFlemish = 34, 11444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kIrishGaelic = 35, 11544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAlbanian = 36, 11644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kRomanian = 37, 11744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCzech = 38, 11844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSlovak = 39, 11944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSlovenian = 40, 12044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kYiddish = 41, 12144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSerbian = 42, 12244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMacedonian = 43, 12344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBulgarian = 44, 12444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUkrainian = 45, 12544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kByelorussian = 46, 12644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUzbek = 47, 12744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKazakh = 48, 12844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAzerbaijani_Cyrillic = 49, 12944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAzerbaijani_Arabic = 50, 13044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArmenian = 51, 13144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGeorgian = 52, 13244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMoldavian = 53, 13344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKirghiz = 54, 13444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTajiki = 55, 13544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTurkmen = 56, 13644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMongolian_Mongolian = 57, 13744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMongolian_Cyrillic = 58, 13844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPashto = 59, 13944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKurdish = 60, 14044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKashmiri = 61, 14144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSindhi = 62, 14244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTibetan = 63, 14344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kNepali = 64, 14444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSanskrit = 65, 14544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMarathi = 66, 14644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBengali = 67, 14744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAssamese = 68, 14844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGujarati = 69, 14944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPunjabi = 70, 15044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kOriya = 71, 15144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMalayalam = 72, 15244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKannada = 73, 15344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTamil = 74, 15444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTelugu = 75, 15544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSinhalese = 76, 15644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBurmese = 77, 15744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKhmer = 78, 15844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLao = 79, 15944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kVietnamese = 80, 16044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kIndonesian = 81, 16144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTagalong = 82, 16244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMalay_Roman = 83, 16344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMalay_Arabic = 84, 16444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAmharic = 85, 16544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTigrinya = 86, 16644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGalla = 87, 16744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSomali = 88, 16844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSwahili = 89, 16944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKinyarwandaRuanda = 90, 17044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kRundi = 91, 17144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kNyanjaChewa = 92, 17244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMalagasy = 93, 17344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEsperanto = 94, 17444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kWelsh = 128, 17544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBasque = 129, 17644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCatalan = 130, 17744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLatin = 131, 17844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kQuenchua = 132, 17944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGuarani = 133, 18044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAymara = 134, 18144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTatar = 135, 18244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUighur = 136, 18344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDzongkha = 137, 18444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kJavanese_Roman = 138, 18544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSundanese_Roman = 139, 18644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGalician = 140, 18744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAfrikaans = 141, 18844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBreton = 142, 18944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kInuktitut = 143, 19044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kScottishGaelic = 144, 19144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kManxGaelic = 145, 19244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kIrishGaelic_WithDotAbove = 146, 19344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTongan = 147, 19444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGreek_Polytonic = 148, 19544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGreenlandic = 149, 19644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAzerbaijani_Roman = 150 19744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com }; 198464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com}; 199464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 200464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com// Windows Language IDs (platformID = 3) 201464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comstruct WindowsLanguageId { 20244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com enum { 20344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUnknown = -1, 20444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAfrikaans_SouthAfrica = 0x0436, 20544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAlbanian_Albania = 0x041C, 20644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAlsatian_France = 0x0484, 20744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAmharic_Ethiopia = 0x045E, 20844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Algeria = 0x1401, 20944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Bahrain = 0x3C01, 21044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Egypt = 0x0C01, 21144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Iraq = 0x0801, 21244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Jordan = 0x2C01, 21344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Kuwait = 0x3401, 21444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Lebanon = 0x3001, 21544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Libya = 0x1001, 21644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Morocco = 0x1801, 21744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Oman = 0x2001, 21844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Qatar = 0x4001, 21944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_SaudiArabia = 0x0401, 22044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Syria = 0x2801, 22144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Tunisia = 0x1C01, 22244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_UAE = 0x3801, 22344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArabic_Yemen = 0x2401, 22444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kArmenian_Armenia = 0x042B, 22544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAssamese_India = 0x044D, 22644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAzeri_Cyrillic_Azerbaijan = 0x082C, 22744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAzeri_Latin_Azerbaijan = 0x042C, 22844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBashkir_Russia = 0x046D, 22944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBasque_Basque = 0x042D, 23044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBelarusian_Belarus = 0x0423, 23144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBengali_Bangladesh = 0x0845, 23244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBengali_India = 0x0445, 23344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBosnian_Cyrillic_BosniaAndHerzegovina = 0x201A, 23444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBosnian_Latin_BosniaAndHerzegovina = 0x141A, 23544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBreton_France = 0x047E, 23644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kBulgarian_Bulgaria = 0x0402, 23744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCatalan_Catalan = 0x0403, 23844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kChinese_HongKongSAR = 0x0C04, 23944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kChinese_MacaoSAR = 0x1404, 24044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kChinese_PeoplesRepublicOfChina = 0x0804, 24144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kChinese_Singapore = 0x1004, 24244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kChinese_Taiwan = 0x0404, 24344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCorsican_France = 0x0483, 24444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCroatian_Croatia = 0x041A, 24544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCroatian_Latin_BosniaAndHerzegovina = 0x101A, 24644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCzech_CzechRepublic = 0x0405, 24744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDanish_Denmark = 0x0406, 24844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDari_Afghanistan = 0x048C, 24944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDivehi_Maldives = 0x0465, 25044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDutch_Belgium = 0x0813, 25144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDutch_Netherlands = 0x0413, 25244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_Australia = 0x0C09, 25344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_Belize = 0x2809, 25444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_Canada = 0x1009, 25544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_Caribbean = 0x2409, 25644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_India = 0x4009, 25744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_Ireland = 0x1809, 25844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_Jamaica = 0x2009, 25944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_Malaysia = 0x4409, 26044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_NewZealand = 0x1409, 26144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_RepublicOfThePhilippines = 0x3409, 26244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_Singapore = 0x4809, 26344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_SouthAfrica = 0x1C09, 26444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_TrinidadAndTobago = 0x2C09, 26544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_UnitedKingdom = 0x0809, 26644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_UnitedStates = 0x0409, 26744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEnglish_Zimbabwe = 0x3009, 26844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kEstonian_Estonia = 0x0425, 26944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFaroese_FaroeIslands = 0x0438, 27044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFilipino_Philippines = 0x0464, 27144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFinnish_Finland = 0x040B, 27244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFrench_Belgium = 0x080C, 27344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFrench_Canada = 0x0C0C, 27444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFrench_France = 0x040C, 27544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFrench_Luxembourg = 0x140c, 27644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFrench_PrincipalityOfMonoco = 0x180C, 27744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFrench_Switzerland = 0x100C, 27844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kFrisian_Netherlands = 0x0462, 27944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGalician_Galician = 0x0456, 28044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGeorgian_Georgia = 0x0437, 28144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGerman_Austria = 0x0C07, 28244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGerman_Germany = 0x0407, 28344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGerman_Liechtenstein = 0x1407, 28444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGerman_Luxembourg = 0x1007, 28544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGerman_Switzerland = 0x0807, 28644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGreek_Greece = 0x0408, 28744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGreenlandic_Greenland = 0x046F, 28844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kGujarati_India = 0x0447, 28944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kHausa_Latin_Nigeria = 0x0468, 29044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kHebrew_Israel = 0x040D, 29144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kHindi_India = 0x0439, 29244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kHungarian_Hungary = 0x040E, 29344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kIcelandic_Iceland = 0x040F, 29444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kIgbo_Nigeria = 0x0470, 29544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kIndonesian_Indonesia = 0x0421, 29644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kInuktitut_Canada = 0x045D, 29744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kInuktitut_Latin_Canada = 0x085D, 29844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kIrish_Ireland = 0x083C, 29944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kisiXhosa_SouthAfrica = 0x0434, 30044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kisiZulu_SouthAfrica = 0x0435, 30144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kItalian_Italy = 0x0410, 30244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kItalian_Switzerland = 0x0810, 30344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kJapanese_Japan = 0x0411, 30444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKannada_India = 0x044B, 30544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKazakh_Kazakhstan = 0x043F, 30644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKhmer_Cambodia = 0x0453, 30744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKiche_Guatemala = 0x0486, 30844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKinyarwanda_Rwanda = 0x0487, 30944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKiswahili_Kenya = 0x0441, 31044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKonkani_India = 0x0457, 31144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKorean_Korea = 0x0412, 31244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kKyrgyz_Kyrgyzstan = 0x0440, 31344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLao_LaoPDR = 0x0454, 31444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLatvian_Latvia = 0x0426, 31544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLithuanian_Lithuania = 0x0427, 31644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLowerSorbian_Germany = 0x082E, 31744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLuxembourgish_Luxembourg = 0x046E, 31844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMacedonian_FYROM_FormerYugoslavRepublicOfMacedonia = 0x042F, 31944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMalay_BruneiDarussalam = 0x083E, 32044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMalay_Malaysia = 0x043E, 32144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMalayalam_India = 0x044C, 32244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMaltese_Malta = 0x043A, 32344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMaori_NewZealand = 0x0481, 32444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMapudungun_Chile = 0x047A, 32544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMarathi_India = 0x044E, 32644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMohawk_Mohawk = 0x047C, 32744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMongolian_Cyrillic_Mongolia = 0x0450, 32844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMongolian_Traditional_PeoplesRepublicOfChina = 0x0850, 32944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kNepali_Nepal = 0x0461, 33044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kNorwegian_Bokmal_Norway = 0x0414, 33144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kNorwegian_Nynorsk_Norway = 0x0814, 33244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kOccitan_France = 0x0482, 33344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kOriya_India = 0x0448, 33444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPashto_Afghanistan = 0x0463, 33544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPolish_Poland = 0x0415, 33644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPortuguese_Brazil = 0x0416, 33744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPortuguese_Portugal = 0x0816, 33844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kPunjabi_India = 0x0446, 33944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kQuechua_Bolivia = 0x046B, 34044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kQuechua_Ecuador = 0x086B, 34144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kQuechua_Peru = 0x0C6B, 34244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kRomanian_Romania = 0x0418, 34344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kRomansh_Switzerland = 0x0417, 34444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kRussian_Russia = 0x0419, 34544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSami_Inari_Finland = 0x243B, 34644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSami_Lule_Norway = 0x103B, 34744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSami_Lule_Sweden = 0x143B, 34844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSami_Northern_Finland = 0x0C3B, 34944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSami_Northern_Norway = 0x043B, 35044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSami_Northern_Sweden = 0x083B, 35144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSami_Skolt_Finland = 0x203B, 35244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSami_Southern_Norway = 0x183B, 35344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSami_Southern_Sweden = 0x1C3B, 35444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSanskrit_India = 0x044F, 35544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSerbian_Cyrillic_BosniaAndHerzegovina = 0x1C1A, 35644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSerbian_Cyrillic_Serbia = 0x0C1A, 35744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSerbian_Latin_BosniaAndHerzegovina = 0x181A, 35844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSerbian_Latin_Serbia = 0x081A, 35944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSesothoSaLeboa_SouthAfrica = 0x046C, 36044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSetswana_SouthAfrica = 0x0432, 36144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSinhala_SriLanka = 0x045B, 36244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSlovak_Slovakia = 0x041B, 36344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSlovenian_Slovenia = 0x0424, 36444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Argentina = 0x2C0A, 36544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Bolivia = 0x400A, 36644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Chile = 0x340A, 36744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Colombia = 0x240A, 36844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_CostaRica = 0x140A, 36944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_DominicanRepublic = 0x1C0A, 37044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Ecuador = 0x300A, 37144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_ElSalvador = 0x440A, 37244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Guatemala = 0x100A, 37344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Honduras = 0x480A, 37444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Mexico = 0x080A, 37544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Nicaragua = 0x4C0A, 37644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Panama = 0x180A, 37744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Paraguay = 0x3C0A, 37844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Peru = 0x280A, 37944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_PuertoRico = 0x500A, 38044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_ModernSort_Spain = 0x0C0A, 38144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_TraditionalSort_Spain = 0x040A, 38244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_UnitedStates = 0x540A, 38344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Uruguay = 0x380A, 38444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSpanish_Venezuela = 0x200A, 38544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSweden_Finland = 0x081D, 38644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSwedish_Sweden = 0x041D, 38744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kSyriac_Syria = 0x045A, 38844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTajik_Cyrillic_Tajikistan = 0x0428, 38944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTamazight_Latin_Algeria = 0x085F, 39044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTamil_India = 0x0449, 39144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTatar_Russia = 0x0444, 39244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTelugu_India = 0x044A, 39344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kThai_Thailand = 0x041E, 39444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTibetan_PRC = 0x0451, 39544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTurkish_Turkey = 0x041F, 39644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kTurkmen_Turkmenistan = 0x0442, 39744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUighur_PRC = 0x0480, 39844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUkrainian_Ukraine = 0x0422, 39944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUpperSorbian_Germany = 0x042E, 40044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUrdu_IslamicRepublicOfPakistan = 0x0420, 40144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUzbek_Cyrillic_Uzbekistan = 0x0843, 40244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kUzbek_Latin_Uzbekistan = 0x0443, 40344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kVietnamese_Vietnam = 0x042A, 40444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kWelsh_UnitedKingdom = 0x0452, 40544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kWolof_Senegal = 0x0448, 40644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kYakut_Russia = 0x0485, 40744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kYi_PRC = 0x0478, 40844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kYoruba_Nigeria = 0x046A 40944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com }; 410464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com}; 411464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 412b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.comclass NameTable : public SubTableContainerTable, public RefCounted<NameTable> { 413464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com public: 414246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Unique identifier for a given name record. 415246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com class NameEntryId { 416246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com public: 417246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com NameEntryId(); // C++ port only, must provide default constructor. 418246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com NameEntryId(int32_t platform_id, int32_t encoding_id, int32_t language_id, 419246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t name_id); 420246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com NameEntryId(const NameEntryId&); 421246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Make gcc -Wnon-virtual-dtor happy. 422246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual ~NameEntryId() {} 423090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 424246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t platform_id() const { return platform_id_; } 425246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t encoding_id() const { return encoding_id_; } 426246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t language_id() const { return language_id_; } 427246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t name_id() const { return name_id_; } 428090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 429246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com const NameEntryId& operator=(const NameEntryId& rhs) const; 430246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com bool operator==(const NameEntryId& rhs) const; 431246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com bool operator<(const NameEntryId& rhs) const; 432090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 433b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com // UNIMPLEMENTED: int hashCode() 434b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com // String toString() 435b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com 436246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com private: 437090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com mutable int32_t platform_id_; 438090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com mutable int32_t encoding_id_; 439090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com mutable int32_t language_id_; 440090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com mutable int32_t name_id_; 441090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com }; 442090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 443464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com class NameEntryBuilder; 444246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 445246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Class to represent a name entry in the name table. 446464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com class NameEntry : public RefCounted<NameEntry> { 447464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com public: 448464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com NameEntry(); 449090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com NameEntry(const NameEntryId& name_entry_id, const ByteVector& name_bytes); 450b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com NameEntry(int32_t platform_id, 451b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t encoding_id, 452b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t language_id, 453b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t name_id, 454b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com const ByteVector& name_bytes); 455464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com virtual ~NameEntry(); 456246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 457246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com NameEntryId& name_entry_id() { return name_entry_id_; } 458246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t platform_id() const { return name_entry_id_.platform_id(); } 459246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t encoding_id() const { return name_entry_id_.encoding_id(); } 460f7c13bf6ff210e3c018971a6f219bb626ae00378arthurhsu@google.com int32_t language_id() const { return name_entry_id_.language_id(); } 461246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t name_id() const { return name_entry_id_.name_id(); } 462246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 463246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the bytes for name. Returned pointer is the address of private 464246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // member of this class, do not attempt to delete. 465246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com ByteVector* NameAsBytes(); 466246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 467246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // C++ port only: get the length of NameAsBytes. 468246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t NameBytesLength(); 469246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 470246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Returns the name in Unicode as UChar array. 471246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: ICU UChar* convention requires caller to delete[] it. 472246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com UChar* Name(); 473246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com bool operator==(const NameEntry& rhs) const; 474464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 475b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com // UNIMPLEMENTED: String toString() 476b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com // int hashCode() 477b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com 478090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com private: 479246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void Init(int32_t platform_id, int32_t encoding_id, int32_t language_id, 480090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com int32_t name_id, const ByteVector* name_bytes); 481090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 482090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com NameEntryId name_entry_id_; 483464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com ByteVector name_bytes_; 484464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 485464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com friend class NameEntryBuilder; 486464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com }; 487464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 488246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Builder of a name entry. 489246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // C++ port: original Java hierarchy inherits from NameEntry. In C++ port, we 490246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // opted not doing so to avoid ref count issues and nasty protected members. 491090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com class NameEntryBuilder : public RefCounted<NameEntryBuilder> { 492464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com public: 493464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com NameEntryBuilder(); 494090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com NameEntryBuilder(const NameEntryId& name_entry_id, 495464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com const ByteVector& name_bytes); 496090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com explicit NameEntryBuilder(const NameEntryId& name_entry_id); 497464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com explicit NameEntryBuilder(NameEntry* entry); 498464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com virtual ~NameEntryBuilder(); 499090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 500246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual void SetName(const UChar* name); 501246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual void SetName(const ByteVector& name_bytes); 502b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com virtual void SetName(const ByteVector& name_bytes, 503b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t offset, 504090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com int32_t length); 505090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 506246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // C++ port only. CALLER_ATTACH is not added because the lifetime shall be 507246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // controlled by this class, therefore the caller shall not increase the ref 508246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // count. 509246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com NameEntry* name_entry() { return name_entry_; } 510090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 511246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com private: 512246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void Init(int32_t platform_id, int32_t encoding_id, int32_t language_id, 513090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com int32_t name_id, const ByteVector* name_bytes); 514090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 515090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com Ptr<NameEntry> name_entry_; 516464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com }; 517246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com typedef std::map<NameEntryId, Ptr<NameEntryBuilder> > NameEntryBuilderMap; 518464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 519246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // An interface for a filter to use with the name entry iterator. This allows 520246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // name entries to be iterated and only those acceptable to the filter will be 521246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // returned. 522464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com class NameEntryFilter { 523464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com public: 524b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com virtual bool Accept(int32_t platform_id, 525b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t encoding_id, 526b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t language_id, 527b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t name_id) = 0; 528464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com // Make gcc -Wnon-virtual-dtor happy. 529464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com virtual ~NameEntryFilter() {} 530464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com }; 531464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 532246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // C++ port only: an in-place filter to mimic Java Iterator's filtering. 533090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com class NameEntryFilterInPlace : public NameEntryFilter { 534464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com public: 535b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com NameEntryFilterInPlace(int32_t platform_id, 536b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t encoding_id, 537b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t language_id, 538b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t name_id); 539090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com // Make gcc -Wnon-virtual-dtor happy. 540090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com virtual ~NameEntryFilterInPlace() {} 541246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 542b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com virtual bool Accept(int32_t platform_id, 543b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t encoding_id, 544b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t language_id, 545b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t name_id); 546464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 547464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com private: 548090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com int32_t platform_id_; 549090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com int32_t encoding_id_; 550090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com int32_t language_id_; 551090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com int32_t name_id_; 552464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com }; 553464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 554333edd91cb32d6acfd0307ba2ae8f60baed75ff4arthurhsu@google.com class NameEntryIterator : public RefIterator<NameEntry, NameTable> { 555464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com public: 556464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com // If filter is NULL, filter through all tables. 557090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com explicit NameEntryIterator(NameTable* table); 558464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com NameEntryIterator(NameTable* table, NameEntryFilter* filter); 559246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual ~NameEntryIterator() {} 560246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 561246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual bool HasNext(); 562246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual CALLER_ATTACH NameEntry* Next(); 563464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 564464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com private: 565464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com int32_t name_index_; 566464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com NameEntryFilter* filter_; 567464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com }; 568464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 569246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // The builder to construct name table for outputting. 570b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com class Builder : public SubTableContainerTable::Builder, 571090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com public RefCounted<Builder> { 572090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com public: 573090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com // Constructor scope altered to public because C++ does not allow base 574090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com // class to instantiate derived class with protected constructors. 575b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com Builder(Header* header, WritableFontData* data); 576b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com Builder(Header* header, ReadableFontData* data); 577b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com 578b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com static CALLER_ATTACH Builder* CreateBuilder(Header* header, 579b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com WritableFontData* data); 580090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 581246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Revert the name builders for the name table to the last version that came 582246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // from data. 583246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void RevertNames(); 584090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 585246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Number of name entry builders contained. 586246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t BuilderCount(); 587090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 588246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: For C++ port, clear() is not implemented. The clear() function 589090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com // implies completely remove name entry builders, which is easy in 590090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com // Java but will take a lot of efforts in C++ to release the builders 591090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com // nicely and correctly. 592090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com // TODO(arthurhsu): IMPLEMENT 593090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com // Clear the name builders for the name table. 594090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com // void clear(); 595090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 596246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Check the existance of a name entry builder by key. 597246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com bool Has(int32_t platform_id, int32_t encoding_id, int32_t language_id, 598090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com int32_t name_id); 599246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 600246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get name entry builder by key. 601246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com CALLER_ATTACH NameEntryBuilder* NameBuilder(int32_t platform_id, 602090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com int32_t encoding_id, int32_t language_id, int32_t name_id); 603246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 604246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Remove name entry builder by key. 605246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com bool Remove(int32_t platform_id, int32_t encoding_id, int32_t language_id, 606090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com int32_t name_id); 607090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 608246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // FontDataTable::Builder API implementation 609246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual CALLER_ATTACH FontDataTable* SubBuildTable(ReadableFontData* data); 610246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual void SubDataSet(); 611246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual int32_t SubDataSizeToSerialize(); 612246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual bool SubReadyToSerialize(); 613246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual int32_t SubSerialize(WritableFontData* new_data); 614090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com 615090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com private: 616246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void Initialize(ReadableFontData* data); 617246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com NameEntryBuilderMap* GetNameBuilders(); 618246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 619246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: callers should use the getter funtion provided above to ensure that 620246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // this is lazily initialized instead of accessing directly. 621090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com NameEntryBuilderMap name_entry_map_; 622090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com }; 623246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 624246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com /**************************************************************************** 625246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com * public methods of NameTable class 626246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com ****************************************************************************/ 627246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual ~NameTable(); 628246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 629246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the format used in the name table. 630246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual int32_t Format(); 631246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 632246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the number of names in the name table. 633246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual int32_t NameCount(); 634246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 635246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the platform id for the given name record. 636246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual int32_t PlatformId(int32_t index); 637246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 638246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the encoding id for the given name record. 639246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // see MacintoshEncodingId, WindowsEncodingId, UnicodeEncodingId 640246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual int32_t EncodingId(int32_t index); 641246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 642246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the language id for the given name record. 643246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual int32_t LanguageId(int32_t index); 644246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 645246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the name id for given name record. 646246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual int32_t NameId(int32_t index); 647246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 648246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the name as bytes for the specified name. If there is no entry for the 649246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // requested name, then empty vector is returned. 650246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual void NameAsBytes(int32_t index, ByteVector* b); 651246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual void NameAsBytes(int32_t platform_id, int32_t encoding_id, 652246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t language_id, int32_t name_id, 653246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com ByteVector* b); 654246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 655246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the name as a UChar* for the given name record. If there is no 656246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // encoding conversion available for the name record then a best attempt 657246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // UChar* will be returned. 658246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: ICU UChar* convention requires caller to delete[] it. 659f7c13bf6ff210e3c018971a6f219bb626ae00378arthurhsu@google.com virtual UChar* Name(int32_t index); 660246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 661246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the name as a UChar* for the specified name. If there is no entry for 662246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // the requested name then NULL is returned. If there is no encoding 663246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // conversion available for the name then a best attempt UChar* will be 664246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // returned. 665246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: ICU UChar* convention requires caller to delete[] it. 666246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual UChar* Name(int32_t platform_id, int32_t encoding_id, 667246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t language_id, int32_t name_id); 668246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 669246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: These functions are renamed in C++ port. Their original Java name is 670246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // nameEntry(). 671246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual CALLER_ATTACH NameEntry* GetNameEntry(int32_t index); 672246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual CALLER_ATTACH NameEntry* GetNameEntry(int32_t platform_id, 673246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t encoding_id, int32_t language_id, int32_t name_id); 674246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 675246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: Not implemented in C++ port due to complexity and low usage. 676246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // virtual void names(std::set<NameEntryPtr>*); 677246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 678246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the iterator to iterate through all name entries. 679333edd91cb32d6acfd0307ba2ae8f60baed75ff4arthurhsu@google.com virtual CALLER_ATTACH NameEntryIterator* Iterator(); 680333edd91cb32d6acfd0307ba2ae8f60baed75ff4arthurhsu@google.com virtual CALLER_ATTACH NameEntryIterator* Iterator(NameEntryFilter* filter); 681246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 682246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com private: 683246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com struct Offset { 684246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com enum { 685246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kFormat = 0, 686246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kCount = 2, 687246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kStringOffset = 4, 688246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kNameRecordStart = 6, 689246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 690246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Format 1 - offset from the end of the name records 691246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kLangTagCount = 0, 692246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kLangTagRecord = 2, 693246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 694246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kNameRecordSize = 12, 695246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Name Records 696246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kNameRecordPlatformId = 0, 697246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kNameRecordEncodingId = 2, 698246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kNameRecordLanguageId = 4, 699246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kNameRecordNameId = 6, 700246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kNameRecordStringLength = 8, 701246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com kNameRecordStringOffset = 10 702246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com }; 703246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com }; 704246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 705246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // The table shall be constructed using Builder, no direct instantiation. 706246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com NameTable(Header* header, ReadableFontData* data); 707246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 708246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the offset to the string data in the name table. 709246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t StringOffset(); 710246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 711246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the offset for the given name record. 712246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t OffsetForNameRecord(int32_t index); 713246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 714246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the length of the string data for the given name record. 715246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t NameLength(int32_t index); 716246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 717246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Get the offset of the string data for the given name record. 718246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t NameOffset(int32_t index); 719246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 720246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: string literals are returned. Caller shall not attempt to manipulate 721246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // the returned pointer. 722246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com static const char* GetEncodingName(int32_t platform_id, int32_t encoding_id); 723246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 724246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: ICU UConverter* convention requires caller to ucnv_close() it. 725246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com static UConverter* GetCharset(int32_t platform_id, int32_t encoding_id); 726246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 727246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: Output will be stored in ByteVector* b. Original data in b will be 728246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // erased and replaced with converted name bytes. 729246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com static void ConvertToNameBytes(const UChar* name, int32_t platform_id, 730246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t encoding_id, ByteVector* b); 731246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 732246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Note: ICU UChar* convention requires caller to delete[] it. 733246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com static UChar* ConvertFromNameBytes(ByteVector* name_bytes, 734246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t platform_id, int32_t encoding_id); 735090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.com}; // class NameTable 736464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comtypedef Ptr<NameTable> NameTablePtr; 737464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comtypedef Ptr<NameTable::NameEntry> NameEntryPtr; 738090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.comtypedef Ptr<NameTable::Builder> NameTableBuilderPtr; 739090ea9e59646e627865c40f9758cfed067a575a1arthurhsu@google.comtypedef Ptr<NameTable::NameEntryBuilder> NameEntryBuilderPtr; 740464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 741464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com} // namespace sfntly 742464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 7435af34fd773f8cfee82321393504f558ddf67c628arthurhsu@google.com#endif // SFNTLY_CPP_SRC_SFNTLY_TABLE_CORE_NAME_TABLE_H_ 744