Changeset 15 for packages/compositor/trunk/Lib/compositor/textUtilities.py
- Timestamp:
- 09/08/07 12:45:29 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
packages/compositor/trunk/Lib/compositor/textUtilities.py
r14 r15 63 63 # specific language 64 64 if language is not None: 65 madeChange = _handleSpecialCasing(case, glyphs, index, uniValue, converted, cmap, language)65 madeChange = _handleSpecialCasing(case, glyphs, index, uniValue, converted, cmap, reversedCMAP, language) 66 66 if madeChange: 67 67 continue 68 68 # no specific language required 69 madeChange = _handleSpecialCasing(case, glyphs, index, uniValue, converted, cmap, None)69 madeChange = _handleSpecialCasing(case, glyphs, index, uniValue, converted, cmap, reversedCMAP, None) 70 70 if madeChange: 71 71 continue … … 96 96 return int(code, 16) 97 97 98 def _handleSpecialCasing(case, glyphs, index, uniValue, converted, cmap, language):98 def _handleSpecialCasing(case, glyphs, index, uniValue, converted, cmap, reversedCMAP, language): 99 99 """ 100 100 Handle a language specific lookup. … … 194 194 if combining == 0 or combining == 230: 195 195 break 196 ## Final_Sigma 197 # Within the closest word boundaries 198 # containing C, there is a cased letter 199 # before C, and there is no cased letter 200 # after C. 201 elif context == "Final_Sigma": 202 glyphNames = [cmap.get(i, i) for i in glyphs] 203 if isWordBreakAfter(glyphNames, index, reversedCMAP): 204 contextMatch = True 205 ## Unknown 196 206 else: 197 207 raise NotImplementedError(context) … … 348 358 def testCaseConversionSimple(): 349 359 """ 350 >>> cmap = {convertCodeToInt("0041") : "A", convertCodeToInt("0061") : "a"} 360 >>> cmap = {convertCodeToInt("0041") : "A", 361 ... convertCodeToInt("0061") : "a" 362 ... } 351 363 >>> convertCase("upper", ["a", "a.alt"], cmap, reverseCMAP(cmap), None) 352 364 ['A', 'a.alt'] … … 362 374 def testCaseConversionLowerAfterI(): 363 375 """ 364 >>> cmap = {convertCodeToInt("0049") : "I", convertCodeToInt("0069") : "i", convertCodeToInt("0307") : "dotabove", convertCodeToInt("0300") : "grave"} 376 >>> cmap = {convertCodeToInt("0049") : "I", 377 ... convertCodeToInt("0069") : "i", 378 ... convertCodeToInt("0307") : "dotabove", 379 ... convertCodeToInt("0300") : "grave" 380 ... } 365 381 >>> convertCase("lower", ["I", "dotabove"], cmap, reverseCMAP(cmap), "TRK") 366 382 ['i'] … … 369 385 def testCaseConversionUpperAfterSoftDotted(): 370 386 """ 371 >>> cmap = {convertCodeToInt("0049") : "I", convertCodeToInt("0069") : "i", convertCodeToInt("0307") : "dotabove", convertCodeToInt("0300") : "grave"} 387 >>> cmap = {convertCodeToInt("0049") : "I", 388 ... convertCodeToInt("0069") : "i", 389 ... convertCodeToInt("0307") : "dotabove", 390 ... convertCodeToInt("0300") : "grave" 391 ... } 372 392 >>> convertCase("upper", ["i", "dotabove"], cmap, reverseCMAP(cmap), "LTH") 373 393 ['I'] … … 378 398 def testCaseConversionLowerMoreAbove(): 379 399 """ 380 >>> cmap = {convertCodeToInt("0049") : "I", convertCodeToInt("0069") : "i", convertCodeToInt("0307") : "dotabove", convertCodeToInt("0300") : "grave"} 400 >>> cmap = {convertCodeToInt("0049") : "I", 401 ... convertCodeToInt("0069") : "i", 402 ... convertCodeToInt("0307") : "dotabove", 403 ... convertCodeToInt("0300") : "grave" 404 ... } 381 405 >>> convertCase("lower", ["I", "grave"], cmap, reverseCMAP(cmap), "LTH") 382 406 ['i', 'dotabove', 'grave'] … … 389 413 def testCaseConversionLowerNotBeforeDot(): 390 414 """ 391 >>> cmap = {convertCodeToInt("0049") : "I", convertCodeToInt("0069") : "i", convertCodeToInt("0307") : "dotabove", convertCodeToInt("0131") : "dotlessi", convertCodeToInt("0327") : "cedilla"} 415 >>> cmap = {convertCodeToInt("0049") : "I", 416 ... convertCodeToInt("0069") : "i", 417 ... convertCodeToInt("0307") : "dotabove", 418 ... convertCodeToInt("0131") : "dotlessi", 419 ... convertCodeToInt("0327") : "cedilla" 420 ... } 392 421 >>> convertCase("lower", ["I"], cmap, reverseCMAP(cmap), "TRK") 393 422 ['dotlessi'] … … 396 425 >>> convertCase("lower", ["I", "cedilla", "dotabove"], cmap, reverseCMAP(cmap), "TRK") 397 426 ['i', 'cedilla'] 427 """ 428 429 def testCaseConversionFinalSigma(): 430 """ 431 >>> cmap = {convertCodeToInt("03A3") : "Sigma", 432 ... convertCodeToInt("03C3") : "sigma", 433 ... convertCodeToInt("03C2") : "finalsigma", 434 ... convertCodeToInt("0020") : "space", 435 ... } 436 >>> convertCase("lower", ["Sigma", "Sigma"], cmap, reverseCMAP(cmap)) 437 ['sigma', 'finalsigma'] 438 >>> convertCase("lower", ["Sigma", "Sigma", "space"], cmap, reverseCMAP(cmap)) 439 ['sigma', 'finalsigma', 'space'] 398 440 """ 399 441
