def main(argv):
    """Test vertical extents to make sure they stay within specified bounds."""
    font_file_name = argv[1]

    if len(argv) > 2:
        language = argv[2]
    else:
        language = None

    if len(argv) > 4:
        ymin = int(argv[3])
        ymax = int(argv[4])
    else:
        font = font_caching.open_font(font_file_name)
        ymin = -font['OS/2'].usWinDescent
        ymax = font['OS/2'].usWinAscent
        if _is_noto_ui_font(font_file_name):
            ymin = max(ymin, -555)
            ymax = min(ymax, 2163)

    exceeding_lines = test_rendering_from_file(sys.stdin, font_file_name, ymin,
                                               ymax, language)

    for line_bounds, text_piece in exceeding_lines:
        print(text_piece.encode('UTF-8'), line_bounds)
def main(argv):
    """Test vertical extents to make sure they stay within specified bounds."""
    font_file_name = argv[1]

    if len(argv) > 2:
        language = argv[2]
    else:
        language = None

    if len(argv) > 4:
        ymin = int(argv[3])
        ymax = int(argv[4])
    else:
        font = font_caching.open_font(font_file_name)
        ymin = -font['OS/2'].usWinDescent
        ymax = font['OS/2'].usWinAscent
        if _is_noto_ui_font(font_file_name):
            ymin = max(ymin, -555)
            ymax = min(ymax, 2163)

    exceeding_lines = test_rendering_from_file(
        sys.stdin, font_file_name, ymin, ymax, language)

    for line_bounds, text_piece in exceeding_lines:
        print text_piece.encode('UTF-8'), line_bounds
Esempio n. 3
0
def get_glyph_vertical_extents(glyph_id, font_file_name):
    """Returns visible vertical extents given a glyph ID and font name."""
    font = font_caching.open_font(font_file_name)
    glyf_set = font.getGlyphSet()

    glyph_name = font.getGlyphName(glyph_id)
    ttglyph = glyf_set[glyph_name]

    return get_glyph_cleaned_extents(ttglyph, glyf_set)
Esempio n. 4
0
def get_glyph_vertical_extents(glyph_id, font_file_name):
    """Returns visible vertical extents given a glyph ID and font name."""
    font = font_caching.open_font(font_file_name)
    glyf_table = font['glyf']

    glyph_name = glyf_table.getGlyphName(glyph_id)
    glyph = glyf_table.glyphs[glyph_name]

    return get_glyph_cleaned_extents(glyph, glyf_table)
Esempio n. 5
0
def get_glyph_vertical_extents(glyph_id, font_file_name):
    """Returns visible vertical extents given a glyph ID and font name."""
    font = font_caching.open_font(font_file_name)
    glyf_set = font.getGlyphSet()

    glyph_name = font.getGlyphName(glyph_id)
    ttglyph = glyf_set[glyph_name]

    return get_glyph_cleaned_extents(ttglyph, glyf_set)