summaryrefslogtreecommitdiff
path: root/fontconvert/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'fontconvert/main.c')
-rw-r--r--fontconvert/main.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/fontconvert/main.c b/fontconvert/main.c
index 675fc49..73151f8 100644
--- a/fontconvert/main.c
+++ b/fontconvert/main.c
@@ -51,7 +51,7 @@ list_type fontname_list;
string dpi = "300";
/* The design size which will affect both the GF and TFM output, unless
- the tfm-header `designsize' option overrides it. (-designsize)
+ the tfm-header `designsize' option overrides it. (-designsize)
`design_size_ratio' is the ratio of the input design size to the
output design size. */
real design_size = 0.0;
@@ -62,9 +62,9 @@ static real design_size_ratio;
static encoding_info_type *encoding_info = NULL;
/* If `omit[n]' is true for an element N, we throw away that character
- in that output. (-omit) */
+ in that output. (-omit) */
static boolean omit[MAX_CHARCODE + 1];
-
+
/* An explicitly specified output filename. (-output-file) */
const_string output_name = NULL;
@@ -75,7 +75,7 @@ int ending_char = MAX_CHARCODE;
/* The variable `translate' maps character codes in the input font to
character codes in the output; by default, maps everything to
- themselves. (-remap) */
+ themselves. (-remap) */
charcode_type translate[MAX_CHARCODE + 1];
/* Says whether to output an EPS file for each character. (-epsf) */
@@ -128,10 +128,10 @@ main (int argc, string argv[])
beginning, which we will fill in with the main font name. */
fontname_list = list_init ();
first_element = LIST_TAPPEND (&fontname_list, string);
-
+
/* Read all the arguments. */
font_name = read_command_line (argc, argv);
-
+
/* Put the main font name in the list. */
*first_element = font_name;
@@ -153,7 +153,7 @@ main (int argc, string argv[])
epsf_start_output (output_name);
if (wants_gf)
gf_start_output (font_name, output_name, dpi,
- BITMAP_FONT_COMMENT (f));
+ BITMAP_FONT_COMMENT (f));
if (wants_tfm)
tfm_start_output (font_name, output_name, design_size,
BITMAP_FONT_DESIGN_SIZE (f));
@@ -161,9 +161,9 @@ main (int argc, string argv[])
/* Have to do this after `tfm_start_output', as it needs to know if
design_size is set or not. */
- if (design_size == 0.0)
+ if (design_size == 0.0)
design_size = BITMAP_FONT_DESIGN_SIZE (f);
-
+
design_size_ratio = BITMAP_FONT_DESIGN_SIZE (f) / design_size;
/* Go through each input font. */
@@ -174,9 +174,9 @@ main (int argc, string argv[])
if (wants_tfm)
tfm_start_font (font_name);
-
+
REPORT1 ("(%s", BITMAP_FONT_FILENAME (f));
-
+
/* The main loop: convert each character. */
for (code = starting_char; code <= ending_char; code++)
{
@@ -204,7 +204,7 @@ main (int argc, string argv[])
close_font (font_name);
REPORT (")\n");
}
-
+
if (wants_epsf)
epsf_finish_output ();
@@ -226,12 +226,12 @@ static void
do_char (char_info_type c)
{
static boolean char_done_p[MAX_CHARCODE + 1];
-
+
charcode_type original_code = CHARCODE (c);
/* Do the character code translation. */
charcode_type code = CHARCODE (c) = translate[original_code];
-
+
if (char_done_p[code])
{
WARNING1 ("Character %d already output", CHARCODE (c));
@@ -259,7 +259,7 @@ do_char (char_info_type c)
negative, we must subtract from it to make it ``larger''. */
CHAR_MIN_ROW (c) -= baseline_adjust[code];
CHAR_MAX_ROW (c) -= baseline_adjust[code];
-
+
/* Text output is already implemented in the library. */
if (wants_text)
{
@@ -278,7 +278,7 @@ do_char (char_info_type c)
if (original_code != code)
REPORT1 ("->%u", code);
-
+
/* Free the space here, instead of in the caller, since we may
change the bitmap. */
free_bitmap (&CHAR_BITMAP (c));
@@ -313,13 +313,13 @@ do_split_char (char_info_type c, int split[])
/* Take the chunk from the big bitmap. */
CHAR_BITMAP (split_char)
= column_extract (CHAR_BITMAP (c), last_col, split_col);
-
+
/* Move the right column over. */
diff = BITMAP_WIDTH (CHAR_BITMAP (c))
- BITMAP_WIDTH (CHAR_BITMAP (split_char));
CHAR_MAX_COL (split_char) -= diff;
CHAR_SET_WIDTH (split_char) -= diff;
-
+
/* Output it. */
do_char (split_char);
@@ -345,18 +345,18 @@ column_extract (bitmap_type source, unsigned start, unsigned finish)
unsigned this_row;
dimensions_type d = { BITMAP_HEIGHT (source), finish - start };
bitmap_type answer = new_bitmap (d);
-
+
/* Move to the given starting column. */
BITMAP_BITS (source) += start;
-
+
for (this_row = 0; this_row < BITMAP_HEIGHT (source); this_row++)
{
one_byte *answer_row = BITMAP_ROW (answer, this_row);
-
+
memcpy (answer_row, BITMAP_BITS (source), BITMAP_WIDTH (answer));
BITMAP_BITS (source) += BITMAP_WIDTH (source);
}
-
+
return answer;
}
@@ -472,24 +472,24 @@ read_command_line (int argc, string argv[])
while (true)
{
g = getopt_long_only (argc, argv, "", long_options, &option_index);
-
+
if (g == EOF)
break;
if (g == '?')
exit (1); /* Unknown option. */
-
+
assert (g == 0); /* We have no short option names. */
-
+
if (ARGUMENT_IS ("baseline-adjust"))
scan_baseline_adjust (optarg);
-
+
else if (ARGUMENT_IS ("column-split"))
scan_column_split (optarg);
-
+
else if (ARGUMENT_IS ("concat"))
append_concat_list (&fontname_list, optarg);
-
+
else if (ARGUMENT_IS ("designsize"))
{
design_size = atof (optarg);
@@ -511,7 +511,7 @@ read_command_line (int argc, string argv[])
else if (ARGUMENT_IS ("filter-size"))
filter_size = atou (optarg);
-
+
else if (ARGUMENT_IS ("filter-threshold"))
{
filter_threshold = atof (optarg);
@@ -519,7 +519,7 @@ read_command_line (int argc, string argv[])
FATAL1 ("The filter threshold should be positive, not %f",
filter_threshold);
}
-
+
else if (ARGUMENT_IS ("fontdimens"))
fontdimens = optarg;
@@ -529,16 +529,16 @@ read_command_line (int argc, string argv[])
fprintf (stderr, USAGE);
exit (0);
}
-
+
else if (ARGUMENT_IS ("omit"))
scan_omit_list (optarg);
-
+
else if (ARGUMENT_IS ("output-file"))
output_name = optarg;
-
+
else if (ARGUMENT_IS ("range"))
GET_RANGE (optarg, starting_char, ending_char);
-
+
else if (ARGUMENT_IS ("random"))
random_max = atof (optarg);
@@ -556,34 +556,34 @@ read_command_line (int argc, string argv[])
else if (ARGUMENT_IS ("version"))
printf ("%s.\n", version_string);
-
+
/* Else it was just a flag; getopt has already done the assignment. */
}
-
+
FINISH_COMMAND_LINE ();
}
/* The string S specifies baseline adjustments for individual
characters: `<charcode>:<adjustment>,...'. We set the element
<charcode> of the global array `baseline_adjust' to the <adjustment>. */
-
+
static void
scan_baseline_adjust (string s)
{
string spec;
-
+
for (spec = strtok (s, ARG_SEP); spec != NULL; spec = strtok (NULL, ARG_SEP))
{
string code;
string adjust = strchr (spec, ':');
-
+
if (adjust == NULL)
FATAL1 ("Baseline adjustments look like `<code>:<integer>', not `%s'",
spec);
-
+
code = substring (spec, 0, adjust - spec - 1);
- baseline_adjust[xparse_charspec (code, encoding_info)]
+ baseline_adjust[xparse_charspec (code, encoding_info)]
= atoi (adjust + 1);
}
}
@@ -599,14 +599,14 @@ scan_column_split (string s)
{
string code;
string column_list = strchr (s, '@');
-
+
if (column_list == NULL)
FATAL1 ("Column splits look like `<code>@<column>,<column>,...', not `%s'",
s);
code = substring (s, 0, column_list - s - 1);
-
- column_split[xparse_charspec (code, encoding_info)]
+
+ column_split[xparse_charspec (code, encoding_info)]
= scan_unsigned_list (column_list + 1);
}
@@ -618,10 +618,10 @@ static void
append_concat_list (list_type *concat_list, string s)
{
string name;
-
+
/* The main routine must initialize CONCAT_LIST before we are called. */
assert (concat_list != NULL && LIST_SIZE (*concat_list) > 0);
-
+
for (name = strtok (s, ARG_SEP); name != NULL; name = strtok (NULL, ARG_SEP))
{
string *new = LIST_TAPPEND (concat_list, string);
@@ -638,7 +638,7 @@ static void
scan_omit_list (string l)
{
string map;
-
+
for (map = strtok (l, ARG_SEP); map != NULL; map = strtok (NULL, ARG_SEP))
{
charcode_type code = xparse_charspec (map, encoding_info);
@@ -652,7 +652,7 @@ scan_omit_list (string l)
code in the original font, and <code2> is the character code to write
it as. No checking for remappings to or from the same character is
done here.
-
+
We set elements of the global array `translate' according to what we
find. */
@@ -660,17 +660,17 @@ static void
scan_remap_list (string l)
{
string map; /* A single remapping. */
-
+
for (map = strtok (l, ARG_SEP); map != NULL; map = strtok (NULL, ARG_SEP))
{
one_byte original, target;
string original_str, target_str;
unsigned length = strlen (map);
-
+
/* Ignore empty mappings, as in `a:b,,c:d'. */
if (length == 0)
continue;
-
+
else if (length < 3)
{
WARNING1 ("Mapping `%s' too short to be valid", map);
@@ -698,7 +698,7 @@ scan_remap_list (string l)
}
original_str = substring (map, 0, length - 3);
}
-
+
else
{ /* Must have form `<code>:<code>'. */
target_str = strchr (map, ':');