[glabels/zint: 10/15] Freeing memory in xml and adding poor mans kerning to bc-zint
- From: Jim Evins <jimevins src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glabels/zint: 10/15] Freeing memory in xml and adding poor mans kerning to bc-zint
- Date: Sat, 10 Jul 2010 04:41:16 +0000 (UTC)
commit 8b662f5b767bb4172e4b1911ecb304bd0b4c5b40
Author: Sam Lown <me samlown com>
Date: Wed Jul 7 21:58:48 2010 +0200
Freeing memory in xml and adding poor mans kerning to bc-zint
src/bc-zint.c | 7 +++++--
src/xml-label.c | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/bc-zint.c b/src/bc-zint.c
index c50160f..3ee26ac 100644
--- a/src/bc-zint.c
+++ b/src/bc-zint.c
@@ -182,7 +182,7 @@ gl_barcode_zint_new (const gchar *id,
static glBarcode *render_zint(struct zint_symbol *symbol, gboolean text_flag) {
int i;
- double string_offset;
+ double string_offset, x;
glBarcode *gbc;
glBarcodeShapeLine *line;
@@ -215,8 +215,11 @@ static glBarcode *render_zint(struct zint_symbol *symbol, gboolean text_flag) {
for ( zstring = render->strings; zstring != NULL; zstring = zstring->next ) {
string_offset = (double) zstring->x - (((6.0 / 9.0) * zstring->length * zstring->fsize) / 2);
for(i = 0; i < zstring->length; i++) {
+ x = 0.0;
+ // Poor man's kerning
+ if (zstring->text[i] == '(') { x = 0.18; }
bchar = gl_barcode_shape_alpha_new();
- bchar->x = (double) string_offset + ((6.0 / 9.0) * i * zstring->fsize);
+ bchar->x = (double) string_offset + ((((6.0 / 9.0) * i) + x) * zstring->fsize);
bchar->y = (double) zstring->y;
bchar->fsize = (double) zstring->fsize;
bchar->c = (char) zstring->text[i];
diff --git a/src/xml-label.c b/src/xml-label.c
index 578a1a0..a0d9c4f 100644
--- a/src/xml-label.c
+++ b/src/xml-label.c
@@ -1053,6 +1053,7 @@ xml_parse_toplevel_span (xmlNodePtr node,
}
}
+ g_free (strip_regex);
if ( text_nodes ) {
/* Store last line. */
lines = g_list_append (lines, text_nodes);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]