mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Set font only once in EMF
Correct fault which led to wrong bytecount - multiple declarations of font not needed Also included HeaderExtension1 and HeaderExtension2 objects for better compatability with GDI As suggested by Alex Roy in #185
This commit is contained in:
parent
bd654647c0
commit
99cd6a3391
@ -260,7 +260,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol) {
|
||||
|
||||
/* Header */
|
||||
emr_header.type = 0x00000001; // EMR_HEADER
|
||||
emr_header.size = 88; // Assuming no additional data in header
|
||||
emr_header.size = 108; // Including extensions
|
||||
emr_header.emf_header.bounds.left = 0;
|
||||
emr_header.emf_header.bounds.right = ceil(symbol->vector->width);
|
||||
emr_header.emf_header.bounds.bottom = ceil(symbol->vector->height);
|
||||
@ -280,7 +280,14 @@ INTERNAL int emf_plot(struct zint_symbol *symbol) {
|
||||
emr_header.emf_header.device.cy = 1000;
|
||||
emr_header.emf_header.millimeters.cx = 300;
|
||||
emr_header.emf_header.millimeters.cy = 300;
|
||||
bytecount = 88;
|
||||
/* HeaderExtension1 */
|
||||
emr_header.emf_header.cb_pixel_format = 0x0000; // None set
|
||||
emr_header.emf_header.off_pixel_format = 0x0000; // None set
|
||||
emr_header.emf_header.b_open_gl = 0x0000; // OpenGL not present
|
||||
/* HeaderExtension2 */
|
||||
emr_header.emf_header.micrometers.cx = 0;
|
||||
emr_header.emf_header.micrometers.cy = 0;
|
||||
bytecount = 108;
|
||||
recordcount = 1;
|
||||
|
||||
/* Create Brushes */
|
||||
@ -624,9 +631,12 @@ INTERNAL int emf_plot(struct zint_symbol *symbol) {
|
||||
}
|
||||
|
||||
// Text
|
||||
if (string_count > 0) {
|
||||
fwrite(&emr_selectobject_font, sizeof (emr_selectobject_t), 1, emf_file);
|
||||
}
|
||||
|
||||
for (i = 0; i < string_count; i++) {
|
||||
spacing = 8 * symbol->scale;
|
||||
fwrite(&emr_selectobject_font, sizeof (emr_selectobject_t), 1, emf_file);
|
||||
fwrite(&text[i], sizeof (emr_exttextoutw_t), 1, emf_file);
|
||||
fwrite(this_string[i], bump_up(text[i].w_emr_text.chars + 1) * 2, 1, emf_file);
|
||||
free(this_string[i]);
|
||||
|
@ -121,6 +121,12 @@ extern "C" {
|
||||
uint32_t n_pal_entries;
|
||||
size_l_t device;
|
||||
size_l_t millimeters;
|
||||
// HeaderExtension1 Object
|
||||
uint32_t cb_pixel_format;
|
||||
uint32_t off_pixel_format;
|
||||
uint32_t b_open_gl;
|
||||
// HeaderExtension2 Object
|
||||
size_l_t micrometers;
|
||||
} emf_header_t;
|
||||
|
||||
typedef struct emr_header {
|
||||
|
Loading…
Reference in New Issue
Block a user