コード例 #1
0
ファイル: ass_drawing.c プロジェクト: AWilco/xbmc
/*
 * \brief Finish a drawing.  This only sets the horizontal advance according
 * to the glyph's bbox at the moment.
 */
static void drawing_finish(ASS_Drawing *drawing, int raw_mode)
{
    int i, offset;
    FT_BBox bbox = drawing->cbox;
    FT_Outline *ol = &drawing->glyph->outline;

    // Close the last contour
    drawing_close_shape(drawing);

    ass_msg(drawing->library, MSGL_V,
            "Parsed drawing with %d points and %d contours", ol->n_points,
            ol->n_contours);

    if (raw_mode)
        return;

    drawing->glyph->root.advance.x = d6_to_d16(bbox.xMax - bbox.xMin);

    drawing->desc = double_to_d6(-drawing->pbo * drawing->scale_y);
    drawing->asc = bbox.yMax - bbox.yMin + drawing->desc;

    // Place it onto the baseline
    offset = (bbox.yMax - bbox.yMin) + double_to_d6(-drawing->pbo *
                                                    drawing->scale_y);
    for (i = 0; i < ol->n_points; i++)
        ol->points[i].y += offset;
}
コード例 #2
0
/*
 * \brief Finish a drawing.  This only sets the horizontal advance according
 * to the glyph's bbox at the moment.
 */
static void drawing_finish(ASS_Drawing *drawing, int raw_mode)
{
    int i, offset;
    FT_BBox bbox;
    FT_Outline *ol = &drawing->glyph->outline;

    // Close the last contour
    drawing_close_shape(drawing);

#if 0
    // Dump points
    for (i = 0; i < ol->n_points; i++) {
        printf("point (%d, %d)\n", (int) ol->points[i].x,
               (int) ol->points[i].y);
    }

    // Dump contours
    for (i = 0; i < ol->n_contours; i++)
        printf("contour %d\n", ol->contours[i]);
#endif

    ass_msg(drawing->library, MSGL_V,
            "Parsed drawing with %d points and %d contours", ol->n_points,
            ol->n_contours);

    if (raw_mode)
        return;

    FT_Outline_Get_CBox(&drawing->glyph->outline, &bbox);
    drawing->glyph->root.advance.x = d6_to_d16(bbox.xMax - bbox.xMin);

    drawing->desc = double_to_d6(-drawing->pbo * drawing->scale_y);
    drawing->asc = bbox.yMax - bbox.yMin + drawing->desc;

    // Place it onto the baseline
    offset = (bbox.yMax - bbox.yMin) + double_to_d6(-drawing->pbo *
                                                    drawing->scale_y);
    for (i = 0; i < ol->n_points; i++)
        ol->points[i].y += offset;
}