1 /*
2     Ming, an SWF output library
3     Copyright (C) 2002  Opaque Industries - http://www.opaque.net/
4 
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) any later version.
9 
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Lesser General Public License for more details.
14 
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19 
20 /* $Id$ */
21 
22 #if 0
23 
24 #include "fontinfo.h"
25 #include "method.h"
26 #include "libming.h"
27 
28 struct SWFFontInfo_s
29 {
30 	struct SWFCharacter_s character;
31 	SWFFontCharacter font;
32 };
33 
34 
35 static void writeDefineSWFFontInfoBlock(SWFBlock block,
36 					SWFByteOutputMethod method, void *data)
37 {
38 	SWFFontInfo info = (SWFFontInfo)block;
39 	SWFFontCharacter font = info->font;
40 	const char* fontname = SWFFont_getName(font);
41 
42 	int l, i;
43 
44 	methodWriteUInt16(CHARACTERID(font), method, data);
45 
46 	l = strlen(fontname);
47 
48 	SWF_assert(l<256);
49 	method(l, data);
50 
51 	for ( i=0; i<l; ++i )
52 		method(fontname[i], data);
53 
54 	method(SWFFont_getFlags(font), data);
55 
56 	/* write glyph-to-code table */
57 	/* XXX - no support for wide codes */
58 
59 	for ( i=0; i<SWFFontCharacter_getNGlyphs(font); ++i )
60 		method(SWFFontCharacter_getGlyphCode(font, i), data);
61 }
62 
63 
64 static int completeDefineSWFFontInfoBlock(SWFBlock block)
65 {
66 	SWFFontInfo info = (SWFFontInfo)block;
67 	SWFFont font = info->font;
68 
69 	return strlen(SWFFont_getName(font)) + 4 + SWFFont_getNGlyphs(font);
70 }
71 
72 
73 SWFFontInfo newDefineSWFFontInfo(SWFFont font)
74 {
75 	SWFFontInfo fontInfo = malloc(sizeof(struct SWFFontInfo_s));
76 
77 	SWFCharacterInit((SWFCharacter)fontInfo);
78 
79 	BLOCK(fontInfo)->type = SWF_DEFINEFONTINFO;
80 	BLOCK(fontInfo)->writeBlock = writeDefineSWFFontInfoBlock;
81 	BLOCK(fontInfo)->complete = completeDefineSWFFontInfoBlock;
82 	fontInfo->font = font;
83 
84 	return fontInfo;
85 }
86 
87 #endif /* 0 */
88 
89 /*
90  * Local variables:
91  * tab-width: 2
92  * c-basic-offset: 2
93  * End:
94  */
95