Ticket #4259: mythburn.2.diff

File mythburn.2.diff, 1.3 KB (added by ido roseman <ido_roseman@…>, 13 years ago)

support for RTL script with fallback where pyfribidi is missing

  • mythburn/scripts/mythburn.py

     
    2626#Optional (only needed for tcrequant)
    2727#transcode - v1.0.2
    2828
     29#Optional (for Right To Left languages)
     30#pyfribidi
     31
    2932#******************************************************************************
    3033#******************************************************************************
    3134#******************************************************************************
     
    156159# no. of processors we have access to
    157160cpuCount = 1
    158161
     162#############################################################
    159163
     164# fix rtl text where pyfribidi is not available
     165# should write a simple algorithm, meanwhile just return the original string
     166def simple_fix_rtl(str):
     167  return str
     168
     169# Bind the name fix_rtl to the appropriate function
     170try:
     171    import pyfribidi
     172except ImportError:
     173    fix_rtl = simple_fix_rtl
     174else:
     175    fix_rtl = pyfribidi.log2vis
     176
    160177#############################################################
    161178# class to hold a font definition
    162179
     
    968985            finished = True
    969986    tmp = []
    970987    for i in lines:
    971         tmp.append( ' '.join(i) )
     988        tmp.append( fix_rtl( ' '.join(i) ) )
    972989    lines = tmp
    973990    return lines
    974991