summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-07-11 23:43:50 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-07-11 23:55:42 (EDT)
commit2fc1dda5466ece084cc080d839312cc33f96ad9f (patch)
tree4c4cb8d82bebf068493e7815abe4c7ea767aff54
parentc3118e7340f62236110cf87f32ea7a278ce0b275 (diff)
parse_bdf_2_1(): Add horizontal offset
-rwxr-xr-xbin/bdf2fbcon9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/bdf2fbcon b/bin/bdf2fbcon
index eafe462..80e789c 100755
--- a/bin/bdf2fbcon
+++ b/bin/bdf2fbcon
@@ -221,6 +221,8 @@ sub parse_bdf_2_1
my $char_bbox_y;
my $char;
my $encoding;
+ my $bytes_w;
+ my $x;
my $y;
$section = BDF_2_1_SECTION_NONE;
@@ -270,7 +272,10 @@ sub parse_bdf_2_1
$char_bbox_x = $argv[2];
$char_bbox_y = $argv[3];
} elsif ($stmt eq 'BITMAP') {
- $y = $font->{'height'} + $font_bbox_y -
+ $bytes_w = int(($char_bbox_w + 7) / 8);
+ $x = ($font->{'width'} + $font_bbox_x) -
+ ($bytes_w * 8 + $char_bbox_x);
+ $y = ($font->{'height'} + $font_bbox_y) -
($char_bbox_h + $char_bbox_y);
$section = BDF_2_1_SECTION_BITMAP;
}
@@ -279,7 +284,7 @@ sub parse_bdf_2_1
$section = BDF_2_1_SECTION_NONE;
} else {
$font->{'chars'}[$encoding]->{'bitmap'}[$y++] =
- hex($line);
+ hex($line) << $x;
}
}
}