1 #define DWG_TYPE DWG_TYPE_MTEXT
2 #include "common.c"
3 
4 void
api_process(dwg_object * obj)5 api_process (dwg_object *obj)
6 {
7   int error, isnew;
8   double rect_height, rect_width, text_height, extents_height, extents_width,
9       linespace_factor;
10   BITCODE_BS attachment, flow_dir, linespace_style, class_version;
11   BITCODE_B unknown_b0, is_not_annotative, default_flag;
12   BITCODE_BL bg_fill_flag, bg_fill_scale, bg_fill_trans;
13   BITCODE_CMC bg_fill_color;
14   char *text;
15   dwg_point_3d ins_pt, extrusion, x_axis_dir;
16   BITCODE_H appid, style;
17   BITCODE_BL ignore_attachment;
18   BITCODE_BL numfragments;
19   BITCODE_BD column_width;
20   BITCODE_BD gutter;
21   BITCODE_B auto_height;
22   BITCODE_B flow_reversed;
23   BITCODE_BS column_type;
24   BITCODE_BL i, num_column_heights;
25   BITCODE_BD *column_heights;
26 
27   Dwg_Version_Type dwg_version = obj->parent->header.version;
28   dwg_ent_mtext *mtext = dwg_object_to_MTEXT (obj);
29 
30   CHK_ENTITY_UTF8TEXT_W_OLD (mtext, MTEXT, text);
31   CHK_ENTITY_3RD (mtext, MTEXT, ins_pt);
32   CHK_ENTITY_3RD_W_OLD (mtext, MTEXT, extrusion);
33   CHK_ENTITY_3RD_W_OLD (mtext, MTEXT, x_axis_dir);
34   CHK_ENTITY_TYPE_W_OLD (mtext, MTEXT, rect_width, BD);
35   CHK_ENTITY_TYPE_W_OLD (mtext, MTEXT, rect_height, BD);
36   CHK_ENTITY_TYPE_W_OLD (mtext, MTEXT, text_height, BD);
37   CHK_ENTITY_TYPE_W_OLD (mtext, MTEXT, attachment, BS);
38   CHK_ENTITY_MAX  (mtext, MTEXT, attachment, BS, 9);
39   CHK_ENTITY_TYPE (mtext, MTEXT, flow_dir, BS); // was drawing_dir in dwg_api
40   CHK_ENTITY_MAX  (mtext, MTEXT, flow_dir, BS, 5);
41   CHK_ENTITY_TYPE_W_OLD (mtext, MTEXT, extents_height, BD);
42   CHK_ENTITY_TYPE_W_OLD (mtext, MTEXT, extents_width, BD);
43   CHK_ENTITY_H (mtext, MTEXT, style);
44   SINCE (R_2000)
45     {
46       CHK_ENTITY_TYPE_W_OLD (mtext, MTEXT, linespace_style, BS);
47       CHK_ENTITY_TYPE_W_OLD (mtext, MTEXT, linespace_factor, BD);
48       CHK_ENTITY_TYPE (mtext, MTEXT, unknown_b0, B);
49     }
50   SINCE (R_2004)
51     {
52       CHK_ENTITY_TYPE (mtext, MTEXT, bg_fill_flag, BL);
53       CHK_ENTITY_MAX  (mtext, MTEXT, bg_fill_flag, BL, 31);
54       CHK_ENTITY_TYPE (mtext, MTEXT, bg_fill_scale, BL);
55       CHK_ENTITY_CMC  (mtext, MTEXT, bg_fill_color);
56       CHK_ENTITY_TYPE (mtext, MTEXT, bg_fill_trans, BL);
57     }
58   SINCE (R_2018)
59     {
60       CHK_ENTITY_TYPE (mtext, MTEXT, is_not_annotative, B);
61       CHK_ENTITY_TYPE (mtext, MTEXT, class_version, BS);
62       CHK_ENTITY_MAX  (mtext, MTEXT, class_version, BS, 10);
63       CHK_ENTITY_TYPE (mtext, MTEXT, default_flag, B);
64       CHK_ENTITY_H (mtext, MTEXT, appid);
65       CHK_ENTITY_TYPE (mtext, MTEXT, column_type, BS);
66       CHK_ENTITY_MAX  (mtext, MTEXT, column_type, BS, 2);
67       CHK_ENTITY_TYPE (mtext, MTEXT, ignore_attachment, BL);
68       if ((BITCODE_BL)attachment != ignore_attachment)
69         fprintf (stderr, "attachment " FORMAT_BS " != ignore_attachment " FORMAT_BL "\n",
70                  attachment, ignore_attachment);
71       CHK_ENTITY_TYPE (mtext, MTEXT, numfragments, BL); // only for column_type == 1
72       CHK_ENTITY_TYPE (mtext, MTEXT, num_column_heights, BL);
73       if (column_type == 1)
74         {
75           if (num_column_heights)
76             fail ("num_column_heights with column_type == 1");
77         }
78       else
79         {
80           if (numfragments)
81             fail ("numfragments with column_type != 1");
82         }
83       CHK_ENTITY_TYPE (mtext, MTEXT, column_width, BD);
84       CHK_ENTITY_TYPE (mtext, MTEXT, gutter, BD);
85       CHK_ENTITY_TYPE (mtext, MTEXT, auto_height, B);
86       CHK_ENTITY_TYPE (mtext, MTEXT, flow_reversed, B);
87       CHK_ENTITY_VECTOR_TYPE (mtext, MTEXT, column_heights, num_column_heights, BD);
88     }
89 }
90