1 // -*- c-basic-offset: 8; indent-tabs-mode: t -*-
2 // vim:ts=8:sw=8:noet:ai:
4 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
6 * This file is part of libass.
8 * libass is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * libass is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with libass; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #include "ass_utils.h"
33 int mystrtoi(char** p
, int base
, int* res
)
36 *res
= strtol(*p
, p
, base
);
37 if (*p
!= start
) return 1;
41 int mystrtou32(char** p
, int base
, uint32_t* res
)
44 *res
= strtoll(*p
, p
, base
);
45 if (*p
!= start
) return 1;
49 int mystrtod(char** p
, double* res
)
53 if (*p
!= start
) return 1;
57 int strtocolor(char** q
, uint32_t* res
)
64 else mp_msg(MSGT_ASS
, MSGL_DBG2
, "suspicious color format: \"%s\"\n", p
);
66 if (*p
== 'H' || *p
== 'h') {
68 result
= mystrtou32(&p
, 16, &color
);
70 result
= mystrtou32(&p
, 0, &color
);
74 unsigned char* tmp
= (unsigned char*)(&color
);
76 b
= tmp
[0]; tmp
[0] = tmp
[3]; tmp
[3] = b
;
77 b
= tmp
[1]; tmp
[1] = tmp
[2]; tmp
[2] = b
;
87 static void sprint_tag(uint32_t tag
, char* dst
)
89 dst
[0] = (tag
>> 24) & 0xFF;
90 dst
[1] = (tag
>> 16) & 0xFF;
91 dst
[2] = (tag
>> 8) & 0xFF;
96 void dump_glyph(FT_Glyph g
)
100 FT_OutlineGlyph og
= (FT_OutlineGlyph
)g
;
101 FT_Outline
* o
= &(og
->outline
);
102 sprint_tag(g
->format
, tag
);
103 printf("glyph: %p \n", g
);
104 printf("format: %s \n", tag
);
105 printf("outline: %p \n", o
);
106 printf("contours: %d, points: %d, points ptr: %p \n", o
->n_contours
, o
->n_points
, o
->points
);
107 for (i
= 0; i
< o
->n_points
; ++i
) {
108 printf(" point %f, %f \n", d6_to_double(o
->points
[i
].x
), d6_to_double(o
->points
[i
].y
));