1 #define NO_INLINE_STDARG
3 #include <aros/debug.h>
4 #include <exec/types.h>
5 #include <diskfont/diskfonttag.h>
7 #include <libraries/mui.h>
9 #include <proto/intuition.h>
10 #include <proto/utility.h>
11 #include <proto/muimaster.h>
12 #include <proto/asl.h>
13 #include <proto/dos.h>
15 #include "fontinfo_class.h"
16 #include "fontbitmap_class.h"
25 Object
*YSizeFactorHigh
;
26 Object
*YSizeFactorLow
;
44 struct TagItem OTags
[26];
45 UWORD AvailSizes
[OT_MAXAVAILSIZES
];
48 typedef struct FontInfoData FontInfoData
;
57 AROS_UFH3(void, CycleToString
,
58 AROS_UFHA(struct Hook
*, hook
, A0
),
59 AROS_UFHA(Object
*, cycle
, A2
),
60 AROS_UFHA(struct CycleToStringP
*, p
, A1
))
65 Object
*str
= p
->String
;
66 get(cycle
, MUIA_Cycle_Active
, &entry
);
67 if (entry
== p
->NumValues
)
69 set(str
, MUIA_Disabled
, FALSE
);
75 MUIA_String_Integer
, p
->Values
[entry
],
83 struct Hook CycleToStringHook
= { {NULL
, NULL
}, UFHN(CycleToString
) };
92 AROS_UFH3(void, IntegerBounds
,
93 AROS_UFHA(struct Hook
*, hook
, A0
),
94 AROS_UFHA(Object
*, obj
, A2
),
95 AROS_UFHA(struct IntegerBoundsP
*, p
, A1
))
100 get(obj
, MUIA_String_Integer
, &t
);
103 set(obj
, MUIA_String_Integer
, p
->Min
);
107 set(obj
, MUIA_String_Integer
, p
->Max
);
114 struct Hook IntegerBoundsHook
= { {NULL
, NULL
}, UFHN(IntegerBounds
) };
117 AROS_UFH3(void, Metric
,
118 AROS_UFHA(struct Hook
*, hook
, A0
),
119 AROS_UFHA(Object
*, obj
, A2
),
120 AROS_UFHA(Object
**, p
, A1
))
128 get(obj
, MUIA_Cycle_Active
, &t
);
130 for (k
= 0; k
< 2; ++k
)
132 set(p
[k
], MUIA_Disabled
, state
);
139 struct Hook MetricHook
= { {NULL
, NULL
}, UFHN(Metric
) };
142 ULONG
fiNew(Class
*cl
, Object
*o
, struct opSet
*msg
)
145 struct TagItem tags
[3];
146 STRPTR filename
= (STRPTR
)GetTagData(MUIA_FontInfo_Filename
, (IPTR
) NULL
, msg
->ops_AttrList
);
147 FT_Face face
= (FT_Face
)GetTagData(MUIA_FontInfo_Face
, (IPTR
) NULL
, msg
->ops_AttrList
);
148 TT_Postscript
*postscript
;
150 Object
*name
, *attached_file
, *size_factor_low
, *size_factor_high
;
151 Object
*stem_weight
, *slant_style
, *horiz_style
, *stem_weight_cycle
, *horiz_style_cycle
;
152 Object
*family
, *fixed
, /**algo_style,*/ *face_num
, *preview
, *preview_group
;
153 Object
*gray
, *test_string
, *test_size
, *serif
, *space_width
;
154 Object
*metric
, *bbox_ymin
, *bbox_ymax
;
159 static const char * const stem_weight_names
[] =
180 static const UBYTE stem_weight_values
[] =
200 static const char * const slant_style_names
[] =
208 static const char * const horiz_style_names
[] =
221 static const UBYTE horiz_style_values
[] =
233 static const char *metric_names
[] =
235 "Global bounding box",
240 "Custom bounding box",
245 if (!filename
|| !face
)
247 DEBUG_FONTINFO(dprintf("FontInfo: filename 0x%x face 0x%x\n", filename
, face
));
251 q
= face
->family_name
;
252 r
= face
->style_name
;
255 while (k
< sizeof(name_buf
) - 1)
271 name_buf
[k
] = ToLower(*q
);
279 postscript
= FT_Get_Sfnt_Table(face
, ft_sfnt_post
);
280 os2
= FT_Get_Sfnt_Table(face
, ft_sfnt_os2
);
282 tags
[0].ti_Tag
= MUIA_Group_Child
;
283 tags
[0].ti_Data
= (ULONG
)ColGroup(2),
284 Child
, Label2("Extra file"),
285 Child
, attached_file
= PopaslObject
,
286 MUIA_Popasl_Type
, ASL_FileRequest
,
287 MUIA_Popstring_String
, StringObject
,
289 MUIA_String_AdvanceOnCR
, TRUE
,
290 MUIA_CycleChain
, TRUE
,
292 MUIA_Popstring_Button
, PopButton(MUII_PopFile
),
293 ASLFR_RejectIcons
, TRUE
,
295 Child
, Label2("Face num"),
296 Child
, face_num
= StringObject
,
298 MUIA_String_Integer
, 0,
299 MUIA_String_Accept
, "0123456789",
300 MUIA_String_AdvanceOnCR
, TRUE
,
301 MUIA_String_MaxLen
, 5,
302 MUIA_CycleChain
, TRUE
,
304 Child
, Label2("Name"),
305 Child
, name
= StringObject
,
307 MUIA_String_Contents
, name_buf
,
308 MUIA_String_AdvanceOnCR
, TRUE
,
309 MUIA_String_MaxLen
, 27,
310 MUIA_CycleChain
, TRUE
,
312 Child
, Label2("Family"),
313 Child
, family
= StringObject
,
315 MUIA_String_Contents
, face
->family_name
,
316 MUIA_String_AdvanceOnCR
, TRUE
,
317 MUIA_CycleChain
, TRUE
,
319 Child
, Label2("Metric"),
320 Child
, metric
= CycleObject
,
321 MUIA_Cycle_Entries
, metric_names
,
322 MUIA_Cycle_Active
, 1,
323 MUIA_CycleChain
, TRUE
,
325 Child
, Label2("Bounding box"),
327 Child
, Label2("yMin"),
328 Child
, bbox_ymin
= StringObject
,
330 MUIA_String_Accept
, "-0123456789",
331 MUIA_String_AdvanceOnCR
, TRUE
,
332 MUIA_String_MaxLen
, 6,
333 MUIA_String_Integer
, face
->bbox
.yMin
,
334 MUIA_CycleChain
, TRUE
,
336 Child
, Label2("yMax"),
337 Child
, bbox_ymax
= StringObject
,
339 MUIA_String_Accept
, "-0123456789",
340 MUIA_String_AdvanceOnCR
, TRUE
,
341 MUIA_String_MaxLen
, 6,
342 MUIA_String_Integer
, face
->bbox
.yMax
,
343 MUIA_CycleChain
, TRUE
,
346 Child
, Label2("Size factor"),
348 Child
, size_factor_low
= StringObject
,
350 MUIA_String_Accept
, "0123456789",
351 MUIA_String_AdvanceOnCR
, TRUE
,
352 MUIA_String_MaxLen
, 6,
353 MUIA_String_Integer
, 1,
354 MUIA_CycleChain
, TRUE
,
357 MUIA_Text_Contents
, "/",
358 MUIA_Text_SetMax
, TRUE
,
360 Child
, size_factor_high
= StringObject
,
362 MUIA_String_Accept
, "0123456789",
363 MUIA_String_AdvanceOnCR
, TRUE
,
364 MUIA_String_MaxLen
, 6,
365 MUIA_String_Integer
, 1,
366 MUIA_CycleChain
, TRUE
,
369 Child
, Label2("Space width"),
370 Child
, space_width
= StringObject
,
372 MUIA_String_Accept
, "0123456789",
373 MUIA_String_AdvanceOnCR
, TRUE
,
374 MUIA_String_MaxLen
, 6,
375 MUIA_String_Integer
, (ULONG
)(face
->max_advance_width
* 250.0 / 72.307),
376 MUIA_CycleChain
, TRUE
,
378 Child
, Label1("Fixed width"),
380 Child
, fixed
= CheckMark((face
->face_flags
& FT_FACE_FLAG_FIXED_WIDTH
) != 0),
381 Child
, RectangleObject
,
384 Child
, Label1("Serif"),
386 Child
, serif
= CheckMark(os2
&& (unsigned)(((os2
->sFamilyClass
>> 8) &
388 Child
, RectangleObject
,
391 Child
, Label2("Stem weight"),
393 Child
, stem_weight_cycle
= CycleObject
,
394 MUIA_Cycle_Entries
, stem_weight_names
,
395 MUIA_CycleChain
, TRUE
,
397 Child
, stem_weight
= StringObject
,
399 MUIA_String_Accept
, "0123456789",
400 MUIA_String_AdvanceOnCR
, TRUE
,
401 MUIA_String_MaxLen
, 4,
402 MUIA_String_Integer
, 128,
403 MUIA_CycleChain
, TRUE
,
406 Child
, Label2("Slant style"),
407 Child
, slant_style
= CycleObject
,
408 MUIA_Cycle_Entries
, slant_style_names
,
409 MUIA_Cycle_Active
, face
->style_flags
& FT_STYLE_FLAG_ITALIC
?
410 (postscript
&& postscript
->italicAngle
> 0 ?
411 OTS_LeftItalic
: OTS_Italic
) : OTS_Upright
,
412 MUIA_CycleChain
, TRUE
,
414 Child
, Label2("Horiz style"),
416 Child
, horiz_style_cycle
= CycleObject
,
417 MUIA_Cycle_Entries
, horiz_style_names
,
418 MUIA_CycleChain
, TRUE
,
420 Child
, horiz_style
= StringObject
,
422 MUIA_String_Accept
, "0123456789",
423 MUIA_String_AdvanceOnCR
, TRUE
,
424 MUIA_String_MaxLen
, 4,
425 MUIA_String_Integer
, 128,
426 MUIA_CycleChain
, TRUE
,
429 /*Child, Label1("No algo style"),
431 Child, algo_style = CheckMark(FALSE),
432 Child, RectangleObject,
436 tags
[1].ti_Tag
= MUIA_Group_Child
;
437 tags
[1].ti_Data
= (ULONG
)VGroup
,
438 GroupFrameT("Preview"),
439 Child
, test_string
= StringObject
,
441 MUIA_String_Contents
, "The quick brown fox jumped over the lazy dog.",
442 MUIA_String_AdvanceOnCR
, TRUE
,
443 MUIA_CycleChain
, TRUE
,
446 Child
, Label2("Size"),
447 Child
, test_size
= StringObject
,
449 MUIA_String_Accept
, "0123456789",
450 MUIA_String_Integer
, 30,
451 MUIA_String_AdvanceOnCR
, TRUE
,
452 MUIA_CycleChain
, TRUE
,
454 Child
, Label2("Anti-aliasing"),
455 Child
, gray
= CheckMark(FALSE
),
457 Child
, ScrollgroupObject
,
458 MUIA_Scrollgroup_Contents
, VirtgroupObject
,
460 Child
, VCenter(HCenter((preview_group
= VGroup
,
461 Child
, preview
= RectangleObject
,
467 tags
[2].ti_Tag
= TAG_MORE
;
468 tags
[2].ti_Data
= (ULONG
)msg
->ops_AttrList
;
470 method
.MethodID
= OM_NEW
;
471 method
.ops_AttrList
= tags
;
472 method
.ops_GInfo
= NULL
;
474 o
= (Object
*)DoSuperMethodA(cl
, o
, (Msg
)&method
);
477 FontInfoData
*dat
= INST_DATA(cl
, o
);
479 dat
->Filename
= filename
;
481 dat
->AttachedFile
= attached_file
;
483 dat
->Family
= family
;
484 dat
->YSizeFactorLow
= size_factor_low
;
485 dat
->YSizeFactorHigh
= size_factor_high
;
486 dat
->StemWeight
= stem_weight
;
487 dat
->SlantStyle
= slant_style
;
488 dat
->HorizStyle
= horiz_style
;
489 dat
->SpaceWidth
= space_width
;
492 //dat->AlgoStyle = algo_style;
493 dat
->FaceNum
= face_num
;
494 dat
->Metric
= metric
;
495 dat
->BBoxYMin
= bbox_ymin
;
496 dat
->BBoxYMax
= bbox_ymax
;
497 dat
->Preview
= preview
;
498 dat
->PreviewGroup
= preview_group
;
499 dat
->TestString
= test_string
;
500 dat
->TestSize
= test_size
;
503 DoMethod(size_factor_low
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
504 size_factor_low
, 4, MUIM_CallHook
, &IntegerBoundsHook
, 1, 65535);
505 DoMethod(size_factor_high
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
506 size_factor_high
, 4, MUIM_CallHook
, &IntegerBoundsHook
, 1, 65535);
508 DoMethod(stem_weight_cycle
, MUIM_Notify
, MUIA_Cycle_Active
, MUIV_EveryTime
,
509 stem_weight_cycle
, 5, MUIM_CallHook
, &CycleToStringHook
,
510 stem_weight
, sizeof(stem_weight_values
), stem_weight_values
);
511 DoMethod(stem_weight
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
512 stem_weight
, 4, MUIM_CallHook
, &IntegerBoundsHook
, 0, 255);
514 DoMethod(horiz_style_cycle
, MUIM_Notify
, MUIA_Cycle_Active
, MUIV_EveryTime
,
515 horiz_style_cycle
, 5, MUIM_CallHook
, &CycleToStringHook
,
516 horiz_style
, sizeof(horiz_style_values
), horiz_style_values
);
517 DoMethod(horiz_style
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
518 horiz_style
, 4, MUIM_CallHook
, &IntegerBoundsHook
, 0, 255);
520 set(stem_weight_cycle
, MUIA_Cycle_Active
,
521 face
->style_flags
& FT_STYLE_FLAG_BOLD
? 11 : 7);
522 set(horiz_style_cycle
, MUIA_Cycle_Active
, 4);
524 DoMethod(test_string
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
525 o
, 1, MUIM_FontInfo_UpdatePreview
);
526 DoMethod(test_size
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
527 o
, 1, MUIM_FontInfo_UpdatePreview
);
528 DoMethod(gray
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
529 o
, 1, MUIM_FontInfo_UpdatePreview
);
531 DoMethod(bbox_ymin
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
532 bbox_ymin
, 4, MUIM_CallHook
, &IntegerBoundsHook
, -32768, 32767);
533 DoMethod(bbox_ymax
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
534 bbox_ymax
, 4, MUIM_CallHook
, &IntegerBoundsHook
, -32768, 32767);
536 DoMethod(metric
, MUIM_Notify
, MUIA_Cycle_Active
, MUIV_EveryTime
,
537 metric
, 6, MUIM_CallHook
, &MetricHook
, bbox_ymin
, bbox_ymax
);
539 set(metric
, MUIA_Cycle_Active
, 0);
541 if (//!(face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) &&
542 FT_Set_Char_Size(face
, 250 * 64, 250 * 64, 2540, 2540) == 0 &&
543 FT_Load_Char(face
, ' ', FT_LOAD_DEFAULT
) == 0)
545 set(space_width
, MUIA_String_Integer
, face
->glyph
->metrics
.horiAdvance
>> 6);
550 int weight
= os2
->usWeightClass
;
553 value
= 0; /* UltraThin */
554 if (weight
< 10) weight
*= 100;
555 if (weight
>= 200) value
= 2; /* Thin */
556 if (weight
>= 300) value
= 4; /* Light */
557 if (weight
>= 400) value
= 7; /* Book */
558 if (weight
>= 500) value
= 8; /* Medium */
559 if (weight
>= 600) value
= 10; /* DemiBold */
560 if (weight
>= 700) value
= 11; /* Bold */
561 if (weight
>= 800) value
= 13; /* Black */
562 if (weight
>= 900) value
= 15; /* UltraBlack */
563 set(stem_weight_cycle
, MUIA_Cycle_Active
, value
);
565 set(horiz_style_cycle
, MUIA_Cycle_Active
, os2
->usWidthClass
- 1);
568 DoMethod(o
, MUIM_FontInfo_UpdatePreview
);
571 DEBUG_FONTINFO(dprintf("FontInfo: created object 0x%lx\n", o
));
577 ULONG
fiDispose(Class
*cl
, Object
*o
)
579 FontInfoData
*dat
= INST_DATA(cl
, o
);
581 return DoSuperMethod(cl
, o
, OM_DISPOSE
);
585 ULONG
fiSetOTags(Class
*cl
, Object
*o
)
587 FontInfoData
*dat
= INST_DATA(cl
, o
);
588 struct TagItem
*tag
= dat
->OTags
;
591 tag
->ti_Tag
= OT_FileIdent
;
594 tag
->ti_Tag
= OT_Engine
;
595 tag
->ti_Data
= (ULONG
)"freetype2";
598 tag
->ti_Tag
= OT_Family
;
599 get(dat
->Family
, MUIA_String_Contents
, &tag
->ti_Data
);
602 //tag->ti_Tag = OT_BName;
603 //tag->ti_Tag = OT_IName;
604 //tag->ti_Tag = OT_BIName;
605 //tag->ti_Tag = OT_SymbolSet; charmap index
607 get(dat
->YSizeFactorLow
, MUIA_String_Integer
, &x
);
608 get(dat
->YSizeFactorHigh
, MUIA_String_Integer
, &y
);
613 tag
->ti_Tag
= OT_YSizeFactor
;
614 tag
->ti_Data
= x
| (y
<< 16);
617 tag
->ti_Tag
= OT_SpaceWidth
;
618 get(dat
->SpaceWidth
, MUIA_String_Integer
, &tag
->ti_Data
);
621 tag
->ti_Tag
= OT_IsFixed
;
622 get(dat
->Fixed
, MUIA_Selected
, &tag
->ti_Data
);
625 tag
->ti_Tag
= OT_SerifFlag
;
626 get(dat
->Serif
, MUIA_Selected
, &tag
->ti_Data
);
629 tag
->ti_Tag
= OT_StemWeight
;
630 get(dat
->StemWeight
, MUIA_String_Integer
, &tag
->ti_Data
);
633 tag
->ti_Tag
= OT_SlantStyle
;
634 get(dat
->SlantStyle
, MUIA_Cycle_Active
, &tag
->ti_Data
);
637 tag
->ti_Tag
= OT_HorizStyle
;
638 get(dat
->HorizStyle
, MUIA_String_Integer
, &tag
->ti_Data
);
641 tag
->ti_Tag
= OT_SpaceFactor
;
642 tag
->ti_Data
= 0x10000;
645 tag
->ti_Tag
= OT_InhibitAlgoStyle
;
646 tag
->ti_Data
= FSF_UNDERLINED
| FSF_BOLD
;
647 //get(dat->AlgoStyle, MUIA_Selected, &tag->ti_Data);
650 tag
->ti_Tag
= OT_SpecCount
;
654 tag
->ti_Tag
= OT_Spec1_FontFile
;
655 tag
->ti_Data
= (ULONG
)dat
->Filename
;
658 tag
->ti_Tag
= OT_Spec3_AFMFile
;
659 get(dat
->AttachedFile
, MUIA_String_Contents
, &tag
->ti_Data
);
662 tag
->ti_Tag
= OT_Spec4_Metric
;
663 get(dat
->Metric
, MUIA_Cycle_Active
, &tag
->ti_Data
);
666 if (tag
[-1].ti_Data
== METRIC_CUSTOMBBOX
)
669 get(dat
->BBoxYMin
, MUIA_String_Integer
, &ymin
);
670 get(dat
->BBoxYMax
, MUIA_String_Integer
, &ymax
);
671 tag
->ti_Tag
= OT_Spec5_BBox
;
672 tag
->ti_Data
= (ymax
<< 16) | (UWORD
)ymin
;
676 tag
->ti_Tag
= OT_Spec6_FaceNum
;
677 get(dat
->FaceNum
, MUIA_String_Integer
, &tag
->ti_Data
);
680 if (!IsDefaultCodePage())
682 tag
->ti_Tag
= OT_Spec2_CodePage
;
683 tag
->ti_Data
= (ULONG
)codepage
;
687 tag
->ti_Tag
= TAG_END
;
689 dat
->AvailSizes
[0] = AROS_WORD2BE(2); // <- number of entries...
690 dat
->AvailSizes
[1] = AROS_WORD2BE(10);
691 dat
->AvailSizes
[2] = AROS_WORD2BE(15);
693 return tag
- dat
->OTags
;
696 ULONG
fiUpdatePreview(Class
*cl
, Object
*o
)
698 FontInfoData
*dat
= INST_DATA(cl
, o
);
706 get(dat
->TestString
, MUIA_String_Contents
, &str
);
707 get(dat
->Gray
, MUIA_Selected
, &gray
);
708 get(dat
->TestSize
, MUIA_String_Integer
, &size
);
710 preview
= FontBitmapObject
,
711 MUIA_FontBitmap_Filename
, dat
->Filename
,
712 MUIA_FontBitmap_OTags
, dat
->OTags
,
713 MUIA_FontBitmap_String
, str
,
714 MUIA_FontBitmap_Gray
, gray
,
715 MUIA_FontBitmap_Size
, size
,
718 DEBUG_FONTINFO(dprintf("FontInfo::UpdatePreview: new 0x%lx\n", preview
));
722 DoMethod(dat
->PreviewGroup
, MUIM_Group_InitChange
);
725 DoMethod(dat
->PreviewGroup
, OM_REMMEMBER
, dat
->Preview
);
726 DisposeObject(dat
->Preview
);
728 DoMethod(dat
->PreviewGroup
, OM_ADDMEMBER
, preview
);
729 DoMethod(dat
->PreviewGroup
, MUIM_Group_ExitChange
);
730 dat
->Preview
= preview
;
733 return preview
!= NULL
;
736 ULONG
fiWriteFiles(Class
*cl
, Object
*o
)
738 FontInfoData
*dat
= INST_DATA(cl
, o
);
744 get(dat
->Name
, MUIA_String_Contents
, &base
);
745 if (!base
|| !base
[0])
748 olddir
= CurrentDir(destdir
);
751 strcat(name
, ".otag");
753 file
= Open(name
, MODE_NEWFILE
);
757 ULONG size
, indirect_size
;
761 size
= sizeof(tag
->ti_Tag
) + (fiSetOTags(cl
, o
) + 2) * sizeof(*tag
);
764 for (tag
= dat
->OTags
; tag
->ti_Tag
!= TAG_END
; ++tag
)
766 if (tag
->ti_Tag
== OT_Spec2_CodePage
)
770 indirect_size
+= sizeof(codepage
);
772 else if (tag
->ti_Tag
& OT_Indirect
&& tag
->ti_Data
)
774 indirect_size
+= strlen((const char *)tag
->ti_Data
) + 1;
781 num_sizes
= 1 + dat
->AvailSizes
[0];
782 indirect_size
+= num_sizes
* sizeof(UWORD
);
784 dat
->OTags
[0].ti_Data
= size
+ indirect_size
;
786 buffer
= malloc(indirect_size
);
790 struct TagItem
*write_tags
;
792 memset(buffer
, 0, indirect_size
);
794 for (tag
= dat
->OTags
; tag
->ti_Tag
!= TAG_END
; ++tag
)
796 if (tag
->ti_Tag
== OT_Spec2_CodePage
)
800 memcpy(buffer
+ offset
, codepage
, sizeof(codepage
));
801 tag
->ti_Data
= size
+ offset
;
802 offset
+= sizeof(codepage
);
804 else if (tag
->ti_Tag
& OT_Indirect
&& tag
->ti_Data
)
806 size_t len
= strlen((const char *)tag
->ti_Data
) + 1;
807 memcpy(buffer
+ offset
, (const char *)tag
->ti_Data
, len
);
808 tag
->ti_Data
= size
+ offset
;
816 tag
->ti_Tag
= OT_AvailSizes
;
817 tag
->ti_Data
= size
+ offset
;
820 tag
->ti_Tag
= TAG_END
;
822 memcpy(buffer
+ offset
, dat
->AvailSizes
, num_sizes
* sizeof(UWORD
));
823 offset
+= num_sizes
* sizeof(UWORD
);
825 write_tags
= malloc(size
);
826 memcpy(write_tags
, dat
->OTags
, size
);
827 for (tag
= write_tags
; tag
->ti_Tag
!= TAG_END
; tag
++)
829 tag
->ti_Tag
= AROS_LONG2BE(tag
->ti_Tag
);
830 tag
->ti_Data
= AROS_LONG2BE(tag
->ti_Data
);
832 tag
->ti_Tag
= AROS_LONG2BE(TAG_END
);
834 Write(file
, write_tags
, size
);
836 Write(file
, buffer
, offset
);
845 strcat(name
, ".font");
847 file
= Open(name
, MODE_NEWFILE
);
850 static UBYTE data
[] = {0x0f, 0x03, 0x00, 0x00 };
851 Write(file
, data
, sizeof(data
));
860 AROS_UFH3(ULONG
, FontInfoDispatch
,
861 AROS_UFHA(Class
*, cl
, A0
),
862 AROS_UFHA(Object
*, o
, A2
),
863 AROS_UFHA(Msg
, msg
, A1
))
869 switch (msg
->MethodID
)
872 ret
= fiNew(cl
, o
, (struct opSet
*)msg
);
877 ret
= fiDispose(cl
, o
);
881 case MUIM_FontInfo_UpdatePreview
:
882 ret
= fiUpdatePreview(cl
, o
);
885 case MUIM_FontInfo_WriteFiles
:
886 ret
= fiWriteFiles(cl
, o
);
890 ret
= DoSuperMethodA(cl
, o
, msg
);
900 void CleanupFontInfoClass(void)
904 MUI_DeleteCustomClass(FontInfoClass
);
905 FontInfoClass
= NULL
;
909 int InitFontInfoClass(void)
911 FontInfoClass
= MUI_CreateCustomClass(NULL
, MUIC_Group
, NULL
,
912 sizeof(FontInfoData
), UFHN(FontInfoDispatch
));
913 return FontInfoClass
!= NULL
;