1 /* 2 * Copyright 2011 Google Inc. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "sfntly/table/core/os2_table.h" 18 19 namespace sfntly { 20 /****************************************************************************** 21 * Constants 22 ******************************************************************************/ 23 const int64_t CodePageRange::kLatin1_1252 = (int64_t)1 << 0; 24 const int64_t CodePageRange::kLatin2_1250 = (int64_t)1 << (int64_t)1; 25 const int64_t CodePageRange::kCyrillic_1251 = (int64_t)1 << 2; 26 const int64_t CodePageRange::kGreek_1253 = (int64_t)1 << 3; 27 const int64_t CodePageRange::kTurkish_1254 = (int64_t)1 << 4; 28 const int64_t CodePageRange::kHebrew_1255 = (int64_t)1 << 5; 29 const int64_t CodePageRange::kArabic_1256 = (int64_t)1 << 6; 30 const int64_t CodePageRange::kWindowsBaltic_1257 = (int64_t)1 << 7; 31 const int64_t CodePageRange::kVietnamese_1258 = (int64_t)1 << 8; 32 const int64_t CodePageRange::kAlternateANSI9 = (int64_t)1 << 9; 33 const int64_t CodePageRange::kAlternateANSI10 = (int64_t)1 << 10; 34 const int64_t CodePageRange::kAlternateANSI11 = (int64_t)1 << 11; 35 const int64_t CodePageRange::kAlternateANSI12 = (int64_t)1 << 12; 36 const int64_t CodePageRange::kAlternateANSI13 = (int64_t)1 << 13; 37 const int64_t CodePageRange::kAlternateANSI14 = (int64_t)1 << 14; 38 const int64_t CodePageRange::kAlternateANSI15 = (int64_t)1 << 15; 39 const int64_t CodePageRange::kThai_874 = (int64_t)1 << 16; 40 const int64_t CodePageRange::kJapanJIS_932 = (int64_t)1 << 17; 41 const int64_t CodePageRange::kChineseSimplified_936 = (int64_t)1 << 18; 42 const int64_t CodePageRange::kKoreanWansung_949 = (int64_t)1 << 19; 43 const int64_t CodePageRange::kChineseTraditional_950 = (int64_t)1 << 20; 44 const int64_t CodePageRange::kKoreanJohab_1361 = (int64_t)1 << 21; 45 const int64_t CodePageRange::kAlternateANSI22 = (int64_t)1 << 22; 46 const int64_t CodePageRange::kAlternateANSI23 = (int64_t)1 << 23; 47 const int64_t CodePageRange::kAlternateANSI24 = (int64_t)1 << 24; 48 const int64_t CodePageRange::kAlternateANSI25 = (int64_t)1 << 25; 49 const int64_t CodePageRange::kAlternateANSI26 = (int64_t)1 << 26; 50 const int64_t CodePageRange::kAlternateANSI27 = (int64_t)1 << 27; 51 const int64_t CodePageRange::kAlternateANSI28 = (int64_t)1 << 28; 52 const int64_t CodePageRange::kMacintoshCharacterSet = (int64_t)1 << 29; 53 const int64_t CodePageRange::kOEMCharacterSet = (int64_t)1 << 30; 54 const int64_t CodePageRange::kSymbolCharacterSet = (int64_t)1 << 31; 55 const int64_t CodePageRange::kReservedForOEM32 = (int64_t)1 << 32; 56 const int64_t CodePageRange::kReservedForOEM33 = (int64_t)1 << 33; 57 const int64_t CodePageRange::kReservedForOEM34 = (int64_t)1 << 34; 58 const int64_t CodePageRange::kReservedForOEM35 = (int64_t)1 << 35; 59 const int64_t CodePageRange::kReservedForOEM36 = (int64_t)1 << 36; 60 const int64_t CodePageRange::kReservedForOEM37 = (int64_t)1 << 37; 61 const int64_t CodePageRange::kReservedForOEM38 = (int64_t)1 << 38; 62 const int64_t CodePageRange::kReservedForOEM39 = (int64_t)1 << 39; 63 const int64_t CodePageRange::kReservedForOEM40 = (int64_t)1 << 40; 64 const int64_t CodePageRange::kReservedForOEM41 = (int64_t)1 << 41; 65 const int64_t CodePageRange::kReservedForOEM42 = (int64_t)1 << 42; 66 const int64_t CodePageRange::kReservedForOEM43 = (int64_t)1 << 43; 67 const int64_t CodePageRange::kReservedForOEM44 = (int64_t)1 << 44; 68 const int64_t CodePageRange::kReservedForOEM45 = (int64_t)1 << 45; 69 const int64_t CodePageRange::kReservedForOEM46 = (int64_t)1 << 46; 70 const int64_t CodePageRange::kReservedForOEM47 = (int64_t)1 << 47; 71 const int64_t CodePageRange::kIBMGreek_869 = (int64_t)1 << 48; 72 const int64_t CodePageRange::kMSDOSRussion_866 = (int64_t)1 << 49; 73 const int64_t CodePageRange::kMSDOSNordic_865 = (int64_t)1 << 50; 74 const int64_t CodePageRange::kArabic_864 = (int64_t)1 << 51; 75 const int64_t CodePageRange::kMSDOSCanadianFrench_863 = (int64_t)1 << 52; 76 const int64_t CodePageRange::kHebrew_862 = (int64_t)1 << 53; 77 const int64_t CodePageRange::kMSDOSIcelandic_861 = (int64_t)1 << 54; 78 const int64_t CodePageRange::kMSDOSPortugese_860 = (int64_t)1 << 55; 79 const int64_t CodePageRange::kIBMTurkish_857 = (int64_t)1 << 56; 80 const int64_t CodePageRange::kIBMCyrillic_855 = (int64_t)1 << 57; 81 const int64_t CodePageRange::kLatin2_852 = (int64_t)1 << 58; 82 const int64_t CodePageRange::kMSDOSBaltic_775 = (int64_t)1 << 59; 83 const int64_t CodePageRange::kGreek_737 = (int64_t)1 << 60; 84 const int64_t CodePageRange::kArabic_708 = (int64_t)1 << 61; 85 const int64_t CodePageRange::kLatin1_850 = (int64_t)1 << 62; 86 const int64_t CodePageRange::kUS_437 = (int64_t)1 << 63; 87 88 /****************************************************************************** 89 * struct UnicodeRange 90 ******************************************************************************/ 91 int32_t UnicodeRange::range(int32_t bit) { 92 if (bit < 0 || bit > kLast) { 93 return -1; 94 } 95 return bit; 96 } 97 98 /****************************************************************************** 99 * class OS2Table 100 ******************************************************************************/ 101 OS2Table::~OS2Table() {} 102 103 int32_t OS2Table::TableVersion() { 104 return data_->ReadUShort(Offset::kVersion); 105 } 106 107 int32_t OS2Table::XAvgCharWidth() { 108 return data_->ReadShort(Offset::kXAvgCharWidth); 109 } 110 111 int32_t OS2Table::UsWeightClass() { 112 return data_->ReadUShort(Offset::kUsWeightClass); 113 } 114 115 int32_t OS2Table::UsWidthClass() { 116 return data_->ReadUShort(Offset::kUsWidthClass); 117 } 118 119 int32_t OS2Table::FsType() { 120 return data_->ReadUShort(Offset::kFsType); 121 } 122 123 int32_t OS2Table::YSubscriptXSize() { 124 return data_->ReadShort(Offset::kYSubscriptXSize); 125 } 126 127 int32_t OS2Table::YSubscriptYSize() { 128 return data_->ReadShort(Offset::kYSubscriptYSize); 129 } 130 131 int32_t OS2Table::YSubscriptXOffset() { 132 return data_->ReadShort(Offset::kYSubscriptXOffset); 133 } 134 135 int32_t OS2Table::YSubscriptYOffset() { 136 return data_->ReadShort(Offset::kYSubscriptYOffset); 137 } 138 139 int32_t OS2Table::YSuperscriptXSize() { 140 return data_->ReadShort(Offset::kYSuperscriptXSize); 141 } 142 143 int32_t OS2Table::YSuperscriptYSize() { 144 return data_->ReadShort(Offset::kYSuperscriptYSize); 145 } 146 147 int32_t OS2Table::YSuperscriptXOffset() { 148 return data_->ReadShort(Offset::kYSuperscriptXOffset); 149 } 150 151 int32_t OS2Table::YSuperscriptYOffset() { 152 return data_->ReadShort(Offset::kYSuperscriptYOffset); 153 } 154 155 int32_t OS2Table::YStrikeoutSize() { 156 return data_->ReadShort(Offset::kYStrikeoutSize); 157 } 158 159 int32_t OS2Table::YStrikeoutPosition() { 160 return data_->ReadShort(Offset::kYStrikeoutPosition); 161 } 162 163 int32_t OS2Table::SFamilyClass() { 164 return data_->ReadShort(Offset::kSFamilyClass); 165 } 166 167 void OS2Table::Panose(ByteVector* value) { 168 assert(value); 169 value->clear(); 170 value->resize(10); 171 data_->ReadBytes(Offset::kPanose, &((*value)[0]), 0, 10); 172 } 173 174 int64_t OS2Table::UlUnicodeRange1() { 175 return data_->ReadULong(Offset::kUlUnicodeRange1); 176 } 177 178 int64_t OS2Table::UlUnicodeRange2() { 179 return data_->ReadULong(Offset::kUlUnicodeRange2); 180 } 181 182 int64_t OS2Table::UlUnicodeRange3() { 183 return data_->ReadULong(Offset::kUlUnicodeRange3); 184 } 185 186 int64_t OS2Table::UlUnicodeRange4() { 187 return data_->ReadULong(Offset::kUlUnicodeRange4); 188 } 189 190 void OS2Table::AchVendId(ByteVector* b) { 191 assert(b); 192 b->clear(); 193 b->resize(4); 194 data_->ReadBytes(Offset::kAchVendId, &((*b)[0]), 0, 4); 195 } 196 197 int32_t OS2Table::FsSelection() { 198 return data_->ReadUShort(Offset::kFsSelection); 199 } 200 201 int32_t OS2Table::UsFirstCharIndex() { 202 return data_->ReadUShort(Offset::kUsFirstCharIndex); 203 } 204 205 int32_t OS2Table::UsLastCharIndex() { 206 return data_->ReadUShort(Offset::kUsLastCharIndex); 207 } 208 209 int32_t OS2Table::STypoAscender() { 210 return data_->ReadShort(Offset::kSTypoAscender); 211 } 212 213 int32_t OS2Table::STypoDescender() { 214 return data_->ReadShort(Offset::kSTypoDescender); 215 } 216 217 int32_t OS2Table::STypoLineGap() { 218 return data_->ReadShort(Offset::kSTypoLineGap); 219 } 220 221 int32_t OS2Table::UsWinAscent() { 222 return data_->ReadUShort(Offset::kUsWinAscent); 223 } 224 225 int32_t OS2Table::UsWinDescent() { 226 return data_->ReadUShort(Offset::kUsWinDescent); 227 } 228 229 int64_t OS2Table::UlCodePageRange1() { 230 return data_->ReadULong(Offset::kUlCodePageRange1); 231 } 232 233 int64_t OS2Table::UlCodePageRange2() { 234 return data_->ReadULong(Offset::kUlCodePageRange2); 235 } 236 237 int32_t OS2Table::SxHeight() { 238 return data_->ReadShort(Offset::kSxHeight); 239 } 240 241 int32_t OS2Table::SCapHeight() { 242 return data_->ReadShort(Offset::kSCapHeight); 243 } 244 245 int32_t OS2Table::UsDefaultChar() { 246 return data_->ReadUShort(Offset::kUsDefaultChar); 247 } 248 249 int32_t OS2Table::UsBreakChar() { 250 return data_->ReadUShort(Offset::kUsBreakChar); 251 } 252 253 int32_t OS2Table::UsMaxContext() { 254 return data_->ReadUShort(Offset::kUsMaxContext); 255 } 256 257 OS2Table::OS2Table(Header* header, ReadableFontData* data) 258 : Table(header, data) { 259 } 260 261 /****************************************************************************** 262 * class OS2Table::Builder 263 ******************************************************************************/ 264 OS2Table::Builder::Builder(Header* header, WritableFontData* data) 265 : TableBasedTableBuilder(header, data) { 266 } 267 268 OS2Table::Builder::Builder(Header* header, ReadableFontData* data) 269 : TableBasedTableBuilder(header, data) { 270 } 271 272 OS2Table::Builder::~Builder() {} 273 274 CALLER_ATTACH FontDataTable* OS2Table::Builder::SubBuildTable( 275 ReadableFontData* data) { 276 FontDataTablePtr table = new OS2Table(header(), data); 277 return table.Detach(); 278 } 279 280 CALLER_ATTACH OS2Table::Builder* 281 OS2Table::Builder::CreateBuilder(Header* header, 282 WritableFontData* data) { 283 Ptr<OS2Table::Builder> builder; 284 builder = new OS2Table::Builder(header, data); 285 return builder.Detach(); 286 } 287 288 int32_t OS2Table::Builder::TableVersion() { 289 return InternalReadData()->ReadUShort(Offset::kVersion); 290 } 291 292 void OS2Table::Builder::SetTableVersion(int32_t version) { 293 InternalWriteData()->WriteUShort(Offset::kVersion, version); 294 } 295 296 int32_t OS2Table::Builder::XAvgCharWidth() { 297 return InternalReadData()->ReadShort(Offset::kXAvgCharWidth); 298 } 299 300 void OS2Table::Builder::SetXAvgCharWidth(int32_t width) { 301 InternalWriteData()->WriteShort(Offset::kXAvgCharWidth, width); 302 } 303 304 int32_t OS2Table::Builder::UsWeightClass() { 305 return InternalReadData()->ReadUShort(Offset::kUsWeightClass); 306 } 307 308 void OS2Table::Builder::SetUsWeightClass(int32_t weight) { 309 InternalWriteData()->WriteUShort(Offset::kUsWeightClass, weight); 310 } 311 312 int32_t OS2Table::Builder::UsWidthClass() { 313 return InternalReadData()->ReadUShort(Offset::kUsWidthClass); 314 } 315 316 void OS2Table::Builder::SetUsWidthClass(int32_t width) { 317 InternalWriteData()->WriteUShort(Offset::kUsWidthClass, width); 318 } 319 320 int32_t OS2Table::Builder::FsType() { 321 return InternalReadData()->ReadUShort(Offset::kFsType); 322 } 323 324 void OS2Table::Builder::SetFsType(int32_t fs_type) { 325 InternalWriteData()->WriteUShort(Offset::kFsType, fs_type); 326 } 327 328 int32_t OS2Table::Builder::YSubscriptXSize() { 329 return InternalReadData()->ReadShort(Offset::kYSubscriptXSize); 330 } 331 332 void OS2Table::Builder::SetYSubscriptXSize(int32_t size) { 333 InternalWriteData()->WriteShort(Offset::kYSubscriptXSize, size); 334 } 335 336 int32_t OS2Table::Builder::YSubscriptYSize() { 337 return InternalReadData()->ReadShort(Offset::kYSubscriptYSize); 338 } 339 340 void OS2Table::Builder::SetYSubscriptYSize(int32_t size) { 341 InternalWriteData()->WriteShort(Offset::kYSubscriptYSize, size); 342 } 343 344 int32_t OS2Table::Builder::YSubscriptXOffset() { 345 return InternalReadData()->ReadShort(Offset::kYSubscriptXOffset); 346 } 347 348 void OS2Table::Builder::SetYSubscriptXOffset(int32_t offset) { 349 InternalWriteData()->WriteShort(Offset::kYSubscriptXOffset, offset); 350 } 351 352 int32_t OS2Table::Builder::YSubscriptYOffset() { 353 return InternalReadData()->ReadShort(Offset::kYSubscriptYOffset); 354 } 355 356 void OS2Table::Builder::SetYSubscriptYOffset(int32_t offset) { 357 InternalWriteData()->WriteShort(Offset::kYSubscriptYOffset, offset); 358 } 359 360 int32_t OS2Table::Builder::YSuperscriptXSize() { 361 return InternalReadData()->ReadShort(Offset::kYSuperscriptXSize); 362 } 363 364 void OS2Table::Builder::SetYSuperscriptXSize(int32_t size) { 365 InternalWriteData()->WriteShort(Offset::kYSuperscriptXSize, size); 366 } 367 368 int32_t OS2Table::Builder::YSuperscriptYSize() { 369 return InternalReadData()->ReadShort(Offset::kYSuperscriptYSize); 370 } 371 372 void OS2Table::Builder::SetYSuperscriptYSize(int32_t size) { 373 InternalWriteData()->WriteShort(Offset::kYSuperscriptYSize, size); 374 } 375 376 int32_t OS2Table::Builder::YSuperscriptXOffset() { 377 return InternalReadData()->ReadShort(Offset::kYSuperscriptXOffset); 378 } 379 380 void OS2Table::Builder::SetYSuperscriptXOffset(int32_t offset) { 381 InternalWriteData()->WriteShort(Offset::kYSuperscriptXOffset, offset); 382 } 383 384 int32_t OS2Table::Builder::YSuperscriptYOffset() { 385 return InternalReadData()->ReadShort(Offset::kYSuperscriptYOffset); 386 } 387 388 void OS2Table::Builder::SetYSuperscriptYOffset(int32_t offset) { 389 InternalWriteData()->WriteShort(Offset::kYSuperscriptYOffset, offset); 390 } 391 392 int32_t OS2Table::Builder::YStrikeoutSize() { 393 return InternalReadData()->ReadShort(Offset::kYStrikeoutSize); 394 } 395 396 void OS2Table::Builder::SetYStrikeoutSize(int32_t size) { 397 InternalWriteData()->WriteShort(Offset::kYStrikeoutSize, size); 398 } 399 400 int32_t OS2Table::Builder::YStrikeoutPosition() { 401 return InternalReadData()->ReadShort(Offset::kYStrikeoutPosition); 402 } 403 404 void OS2Table::Builder::SetYStrikeoutPosition(int32_t position) { 405 InternalWriteData()->WriteShort(Offset::kYStrikeoutPosition, position); 406 } 407 408 int32_t OS2Table::Builder::SFamilyClass() { 409 return InternalReadData()->ReadShort(Offset::kSFamilyClass); 410 } 411 412 void OS2Table::Builder::SetSFamilyClass(int32_t family) { 413 InternalWriteData()->WriteShort(Offset::kSFamilyClass, family); 414 } 415 416 void OS2Table::Builder::Panose(ByteVector* value) { 417 assert(value); 418 value->clear(); 419 value->resize(Offset::kPanoseLength); 420 InternalReadData()->ReadBytes(Offset::kPanose, 421 &((*value)[0]), 422 0, 423 Offset::kPanoseLength); 424 } 425 426 void OS2Table::Builder::SetPanose(ByteVector* panose) { 427 assert(panose); 428 if (panose->size() != Offset::kPanoseLength) { 429 #if !defined (SFNTLY_NO_EXCEPTION) 430 throw IllegalArgumentException("Panose bytes must be exactly 10 in length"); 431 #endif 432 return; 433 } 434 InternalWriteData()->WriteBytes(Offset::kPanose, panose); 435 } 436 437 int64_t OS2Table::Builder::UlUnicodeRange1() { 438 return InternalReadData()->ReadULong(Offset::kUlUnicodeRange1); 439 } 440 441 void OS2Table::Builder::SetUlUnicodeRange1(int64_t range) { 442 InternalWriteData()->WriteULong(Offset::kUlUnicodeRange1, range); 443 } 444 445 int64_t OS2Table::Builder::UlUnicodeRange2() { 446 return InternalReadData()->ReadULong(Offset::kUlUnicodeRange2); 447 } 448 449 void OS2Table::Builder::SetUlUnicodeRange2(int64_t range) { 450 InternalWriteData()->WriteULong(Offset::kUlUnicodeRange2, range); 451 } 452 453 int64_t OS2Table::Builder::UlUnicodeRange3() { 454 return InternalReadData()->ReadULong(Offset::kUlUnicodeRange3); 455 } 456 457 void OS2Table::Builder::SetUlUnicodeRange3(int64_t range) { 458 InternalWriteData()->WriteULong(Offset::kUlUnicodeRange3, range); 459 } 460 461 int64_t OS2Table::Builder::UlUnicodeRange4() { 462 return InternalReadData()->ReadULong(Offset::kUlUnicodeRange4); 463 } 464 465 void OS2Table::Builder::SetUlUnicodeRange4(int64_t range) { 466 InternalWriteData()->WriteULong(Offset::kUlUnicodeRange4, range); 467 } 468 469 void OS2Table::Builder::AchVendId(ByteVector* b) { 470 assert(b); 471 b->clear(); 472 b->resize(4); 473 InternalReadData()->ReadBytes(Offset::kAchVendId, &((*b)[0]), 0, 4); 474 } 475 476 void OS2Table::Builder::SetAchVendId(ByteVector* b) { 477 assert(b); 478 assert(b->size()); 479 InternalWriteData()->WriteBytesPad(Offset::kAchVendId, 480 b, 481 0, 482 std::min<size_t>( 483 (size_t)Offset::kAchVendIdLength, 484 b->size()), 485 static_cast<byte_t>(' ')); 486 } 487 488 int32_t OS2Table::Builder::FsSelection() { 489 return InternalReadData()->ReadUShort(Offset::kFsSelection); 490 } 491 492 void OS2Table::Builder::SetFsSelection(int32_t fs_selection) { 493 InternalWriteData()->WriteUShort(Offset::kFsSelection, fs_selection); 494 } 495 496 int32_t OS2Table::Builder::UsFirstCharIndex() { 497 return InternalReadData()->ReadUShort(Offset::kUsFirstCharIndex); 498 } 499 500 void OS2Table::Builder::SetUsFirstCharIndex(int32_t first_index) { 501 InternalWriteData()->WriteUShort(Offset::kUsFirstCharIndex, first_index); 502 } 503 504 int32_t OS2Table::Builder::UsLastCharIndex() { 505 return InternalReadData()->ReadUShort(Offset::kUsLastCharIndex); 506 } 507 508 void OS2Table::Builder::SetUsLastCharIndex(int32_t last_index) { 509 InternalWriteData()->WriteUShort(Offset::kUsLastCharIndex, last_index); 510 } 511 512 int32_t OS2Table::Builder::STypoAscender() { 513 return InternalReadData()->ReadShort(Offset::kSTypoAscender); 514 } 515 516 void OS2Table::Builder::SetSTypoAscender(int32_t ascender) { 517 InternalWriteData()->WriteShort(Offset::kSTypoAscender, ascender); 518 } 519 520 int32_t OS2Table::Builder::STypoDescender() { 521 return InternalReadData()->ReadShort(Offset::kSTypoDescender); 522 } 523 524 void OS2Table::Builder::SetSTypoDescender(int32_t descender) { 525 InternalWriteData()->WriteShort(Offset::kSTypoDescender, descender); 526 } 527 528 int32_t OS2Table::Builder::STypoLineGap() { 529 return InternalReadData()->ReadShort(Offset::kSTypoLineGap); 530 } 531 532 void OS2Table::Builder::SetSTypoLineGap(int32_t line_gap) { 533 InternalWriteData()->WriteShort(Offset::kSTypoLineGap, line_gap); 534 } 535 536 int32_t OS2Table::Builder::UsWinAscent() { 537 return InternalReadData()->ReadUShort(Offset::kUsWinAscent); 538 } 539 540 void OS2Table::Builder::SetUsWinAscent(int32_t ascent) { 541 InternalWriteData()->WriteUShort(Offset::kUsWinAscent, ascent); 542 } 543 544 int32_t OS2Table::Builder::UsWinDescent() { 545 return InternalReadData()->ReadUShort(Offset::kUsWinDescent); 546 } 547 548 void OS2Table::Builder::SetUsWinDescent(int32_t descent) { 549 InternalWriteData()->WriteUShort(Offset::kUsWinDescent, descent); 550 } 551 552 int64_t OS2Table::Builder::UlCodePageRange1() { 553 return InternalReadData()->ReadULong(Offset::kUlCodePageRange1); 554 } 555 556 void OS2Table::Builder::SetUlCodePageRange1(int64_t range) { 557 InternalWriteData()->WriteULong(Offset::kUlCodePageRange1, range); 558 } 559 560 int64_t OS2Table::Builder::UlCodePageRange2() { 561 return InternalReadData()->ReadULong(Offset::kUlCodePageRange2); 562 } 563 564 void OS2Table::Builder::SetUlCodePageRange2(int64_t range) { 565 InternalWriteData()->WriteULong(Offset::kUlCodePageRange2, range); 566 } 567 568 int32_t OS2Table::Builder::SxHeight() { 569 return InternalReadData()->ReadShort(Offset::kSxHeight); 570 } 571 572 void OS2Table::Builder::SetSxHeight(int32_t height) { 573 InternalWriteData()->WriteShort(Offset::kSxHeight, height); 574 } 575 576 int32_t OS2Table::Builder::SCapHeight() { 577 return InternalReadData()->ReadShort(Offset::kSCapHeight); 578 } 579 580 void OS2Table::Builder::SetSCapHeight(int32_t height) { 581 InternalWriteData()->WriteShort(Offset::kSCapHeight, height); 582 } 583 584 int32_t OS2Table::Builder::UsDefaultChar() { 585 return InternalReadData()->ReadUShort(Offset::kUsDefaultChar); 586 } 587 588 void OS2Table::Builder::SetUsDefaultChar(int32_t default_char) { 589 InternalWriteData()->WriteUShort(Offset::kUsDefaultChar, default_char); 590 } 591 592 int32_t OS2Table::Builder::UsBreakChar() { 593 return InternalReadData()->ReadUShort(Offset::kUsBreakChar); 594 } 595 596 void OS2Table::Builder::SetUsBreakChar(int32_t break_char) { 597 InternalWriteData()->WriteUShort(Offset::kUsBreakChar, break_char); 598 } 599 600 int32_t OS2Table::Builder::UsMaxContext() { 601 return InternalReadData()->ReadUShort(Offset::kUsMaxContext); 602 } 603 604 void OS2Table::Builder::SetUsMaxContext(int32_t max_context) { 605 InternalWriteData()->WriteUShort(Offset::kUsMaxContext, max_context); 606 } 607 608 } // namespace sfntly 609