Changeset 459
- Timestamp:
- 02/15/09 05:24:43 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
packages/compositor/trunk/Lib/compositor/tables.py
r240 r459 22 22 from featureList import FeatureList 23 23 from lookupList import GSUBLookupList, GPOSLookupList 24 from subTablesBase import Coverage 24 25 from classDefinitionTables import MarkAttachClassDef, GlyphClassDef 25 26 from textUtilities import isWordBreakBefore, isWordBreakAfter … … 359 360 self.GlyphClassDef = None 360 361 self.MarkAttachClassDef = None 362 self.LigCaretList = None 361 363 362 364 def loadFromFontTools(self, table): 363 365 table = table.table 364 self.GlyphClassDef = GlyphClassDef().loadFromFontTools(table.GlyphClassDef) 366 if table.GlyphClassDef is not None: 367 self.GlyphClassDef = GlyphClassDef().loadFromFontTools(table.GlyphClassDef) 365 368 if table.AttachList is not None: 366 369 raise NotImplementedError("Need GDEF sample with AttachList") 367 370 if table.LigCaretList is not None: 368 raise NotImplementedError("Need GDEF sample with LigCaretList") 369 if table.MarkAttachClassDef is None: 370 self.MarkAttachClassDef = None 371 else: 371 self.LigCaretList = LigCaretList().loadFromFontTools(table.LigCaretList) 372 if table.MarkAttachClassDef is not None: 372 373 self.MarkAttachClassDef = MarkAttachClassDef().loadFromFontTools(table.MarkAttachClassDef) 373 374 return self 375 376 377 class LigCaretList(object): 378 379 """ 380 Deviation from spec: 381 - LigGlyphCount attribute is not implemented. 382 """ 383 384 __slots__ = ["LigGlyph", "Coverage"] 385 386 def __init__(self): 387 self.LigGlyph = [] 388 self.Coverage = None 389 390 def loadFromFontTools(self, table): 391 self.Coverage = Coverage().loadFromFontTools(table.Coverage) 392 for ligGlyph in table.LigGlyph: 393 ligGlyph = LigGlyph().loadFromFontTools(ligGlyph) 394 self.LigGlyph.append(ligGlyph) 395 return self 396 397 398 class LigGlyph(object): 399 400 """ 401 Deviation from spec: 402 - CaretValueCount attribute is not implemented. 403 """ 404 405 __slots__ = ["CaretValue"] 406 407 def __init__(self): 408 self.CaretValue = [] 409 410 def loadFromFontTools(self, ligGlyph): 411 for caretValue in ligGlyph.CaretValue: 412 format = caretValue.Format 413 if format == 1: 414 caretValue = CaretValueFormat1().loadFromFontTools(caretValue) 415 elif format == 2: 416 caretValue = CaretValueFormat2().loadFromFontTools(caretValue) 417 else: 418 caretValue = CaretValueFormat3().loadFromFontTools(caretValue) 419 self.CaretValue.append(caretValue) 420 return self 421 422 423 class CaretValueFormat1(object): 424 425 __slots__ = ["CaretValueFormat", "Coordinate"] 426 427 def __init__(self): 428 self.CaretValueFormat = 1 429 self.Coordinate = None 430 431 def loadFromFontTools(self, caretValue): 432 self.Coordinate = caretValue.Coordinate 433 return self 434 435 436 class CaretValueFormat2(object): 437 438 __slots__ = ["CaretValueFormat", "CaretValuePoint"] 439 440 def __init__(self): 441 self.CaretValueFormat = 2 442 self.CaretValuePoint = None 443 444 def loadFromFontTools(self, caretValue): 445 self.CaretValuePoint = caretValue.CaretValuePoint 446 return self 447 448 449 class CaretValueFormat3(CaretValueFormat1): 450 451 """ 452 Deviation from spec: 453 - DeviceTable attribute is not implemented. 454 """ 455 456 __slots__ = ["CaretValueFormat", "Coordinate", "DeviceTable"] 457 458 def __init__(self): 459 super(CaretValueFormat3, self).__init__() 460 self.DeviceTable = None 461
Note: See TracChangeset
for help on using the changeset viewer.
