Changeset 97

Show
Ignore:
Timestamp:
10/28/07 20:11:10 (15 months ago)
Author:
verbosus
Message:

Automatic Text: fixed a bug when entering digits directly into the textboxes

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • hacks/trunk/automatic_text.py

    r96 r97  
    174174    return glyphs 
    175175 
     176def map_digit_to_name(digit): 
     177    if digit in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']: 
     178        return DIGITS[int(digit)] 
     179    else: 
     180        return digit 
     181     
    176182def get_glyph_name(glyph): 
     183    glyph = map_digit_to_name(glyph) 
    177184    if not glyph.startswith('/'): 
    178185        return '/%s' % glyph 
     
    212219    for i in range(len(fl.font)): 
    213220        if not in_sequence: 
    214             if fl.font[i].name == glyph_from: 
     221            if fl.font[i].name == map_digit_to_name(glyph_from): 
    215222                glyphset.append(get_glyph_name(fl.font[i].name)) 
    216223                in_sequence = True 
    217224        else: 
    218225            glyphset.append(get_glyph_name(fl.font[i].name)) 
    219             if fl.font[i].name == glyph_to: 
     226            if fl.font[i].name == map_digit_to_name(glyph_to): 
    220227                break 
    221228    generate(glyphset, get_glyph_name(glyph_name))