/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009,2010 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <grub/fontformat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_TRUETYPE_TAGS_H
#include FT_TRUETYPE_TABLES_H
#define FT_ERRORDEF(e, v, s) [e] = s,
#define FT_ERROR_END_LIST };
#include FT_ERRORS_H
#include "progname.h"
struct grub_glyph_info
{
int width;
int height;
int x_ofs;
int y_ofs;
int device_width;
int bitmap_size;
};
enum file_formats
{
PF2,
};
struct grub_font_info
{
char* name;
int style;
int desc;
int asce;
int size;
int max_width;
int max_height;
int min_y;
int max_y;
int flags;
int num_range;
int num_glyphs;
};
{
{0, 0, 0, 0}
};
int font_verbosity;
static void
{
if (status)
else
printf (_("\
Usage: %s [OPTIONS] FONT_FILES\n\
\nOptions:\n\
-o, --output=FILE_NAME set output file name\n\
--ascii-bitmaps save only the ASCII bitmaps\n\
--width-spec create width summary file\n\
-i, --index=N set face index\n\
-r, --range=A-B[,C-D] set font range\n\
-n, --name=S set font family name\n\
-s, --size=N set font size\n\
-d, --desc=N set font descent\n\
-c, --asce=N set font ascent\n\
-b, --bold convert to bold font\n\
-a, --force-autohint force autohint\n\
--no-hinting disable hinting\n\
--no-bitmap ignore bitmap strikes when loading\n\
-h, --help display this message and exit\n\
-V, --version print version information and exit\n\
-v, --verbose print verbose messages\n\
\n\
}
void
{
if (*mask == 0)
{
(*data)++;
**data = 0;
*mask = 128;
}
if (not_blank)
*mask >>= 1;
}
static void
{
if (err)
{
printf (_("Freetype Error %d loading glyph 0x%x for U+0x%x%s"),
_(" (leftmost)"))
""));
else
printf ("\n");
return;
}
if (nocut)
else
{
{
& (1 << (7 - (j & 7))))
break;
break;
}
{
& (1 << (7 - (j & 7))))
break;
break;
}
cutbottom = 0;
{
break;
break;
}
{
break;
break;
}
cutright = 0;
}
font_info->num_glyphs++;
mask = 0;
(1 << (7 - (i & 7))));
}
struct glyph_replace
{
};
/* TODO: sort glyph_replace and use binary search if necessary. */
static void
{
if (!glyph_idx)
return;
{
break;
}
{
int i;
for (i = 0; grub_unicode_arabic_shapes[i].code; i++)
{
.right_linked);
if (idx2)
break;
}
}
{
break;
}
{
int i;
for (i = 0; grub_unicode_arabic_shapes[i].code; i++)
{
.left_linked);
if (idx2)
break;
}
}
{
break;
}
{
int i;
for (i = 0; grub_unicode_arabic_shapes[i].code; i++)
{
.both_linked);
if (idx2)
break;
}
}
}
struct gsub_header
{
} __attribute__ ((packed));
struct gsub_features
{
struct
{
} __attribute__ ((packed));
struct gsub_feature
{
} __attribute__ ((packed));
struct gsub_lookup_list
{
} __attribute__ ((packed));
struct gsub_lookup
{
} __attribute__ ((packed));
struct gsub_substitution
{
union
{
struct
{
};
};
} __attribute__ ((packed));
struct gsub_coverage_list
{
} __attribute__ ((packed));
struct gsub_coverage_ranges
{
struct
{
} __attribute__ ((packed));
static void
{
}
static void
struct gsub_lookup_list *lookups,
{
int j, k;
int i;
{
if (substtype == GSUB_SUBSTITUTION_DELTA)
printf (_("Out of range substitution (%d, %d)\n"), i,
else
}
{
{
continue;
}
lookup = (struct gsub_lookup *)
((grub_uint8_t *) lookups
{
printf (_("Unsupported substitution type: %d\n"),
continue;
}
{
printf (_("Unsupported substitution flag: 0x%x\n"),
}
switch (feattag)
{
case FEATURE_INIT:
target = &subst_leftjoin;
else
break;
case FEATURE_FINA:
else
target = &subst_leftjoin;
break;
case FEATURE_MEDI:
target = &subst_medijoin;
break;
}
{
sub = (struct gsub_substitution *)
if (substtype != GSUB_SUBSTITUTION_MAP
&& substtype != GSUB_SUBSTITUTION_DELTA)
{
printf (_("Unsupported substitution specification: %d\n"),
continue;
}
i = 0;
if (covertype == GSUB_COVERAGE_LIST)
{
int l;
}
else if (covertype == GSUB_COVERAGE_RANGE)
{
int l, m;
subst (m);
}
else
}
}
}
void
{
{
{
gsub_len = 0;
}
}
if (gsub)
{
int i;
for (i = 0; i < nfeatures; i++)
{
((grub_uint8_t *) features
printf (_("WARNING: unsupported feature parameters: %x\n"),
switch (feattag)
{
/* Used for retrieving all possible variants. Useless in grub. */
case FEATURE_AALT:
break;
/* FIXME: Add ligature support. */
case FEATURE_LIGA:
case FEATURE_RLIG:
break;
/* Cursive form variants. */
case FEATURE_FINA:
case FEATURE_INIT:
case FEATURE_MEDI:
break;
default:
{
int j;
str[4] = 0;
for (j = 0; j < 4; j++)
if (!grub_isgraph (str[j]))
str[j] = '?';
}
}
}
}
{
int i;
j++)
}
else
{
}
}
void
{
}
void
{
*offset += 10;
}
void
{
int num;
{
printf (_("Width %d, Height %d, X offset %d, Y offset %d, Device width %d\n"),
if (xmin > 0)
xmin = 0;
mask = 0x80;
{
int line_pos;
line_pos = 0;
{
{
mask >>= 1;
if (mask == 0)
{
mask = 0x80;
bitmap++;
}
}
else if ((x >= 0) &&
(x < glyph->device_width) &&
{
}
else
}
}
}
}
void
{
int num;
if (! file)
int correct_size;
{
correct_size = 1;
{
/* printf ("Width or height from glyph U+%04x not supported, skipping.\n", glyph->char_code); */
correct_size = 0;
}
int row;
{
if (correct_size)
else
}
}
}
void
{
if (! file)
}
void
{
int offset;
if (! file)
offset = 0;
offset += 12;
style_name[0] = 0;
if (! style_name[0])
"bold" : "normal",
"italic" : "normal",
{
else
}
{
else
}
if (font_verbosity > 0)
{
}
if (font_verbosity > 0)
sizeof(FONT_FORMAT_SECTION_NAMES_CHAR_INDEX) - 1,
file);
{
data8 = 0;
}
leng = 0xffffffff;
{
}
}
int
{
int font_index = 0;
int font_size = 0;
set_program_name (argv[0]);
/* Check for options. */
while (1)
{
if (c == -1)
break;
else
switch (c)
{
case 'b':
break;
case 0x100:
break;
case 0x101:
break;
case 'a':
break;
case 'o':
break;
case 'n':
break;
case 'i':
break;
case 's':
break;
case 'r':
{
char *p = optarg;
while (1)
{
grub_uint32_t a, b;
a = strtoul (p, &p, 0);
if (*p != '-')
grub_util_error (_("invalid font range"));
b = strtoul (p + 1, &p, 0);
sizeof (grub_uint32_t) * 2);
if (*p)
{
if (*p != ',')
grub_util_error (_("invalid font range"));
else
p++;
}
else
break;
}
break;
}
case 'd':
break;
case 'e':
break;
case 'h':
usage (0);
break;
case 'V':
return 0;
case 'v':
break;
case 0x102:
break;
case 0x103:
break;
default:
usage (1);
break;
}
}
{
grub_util_error (_("Option --ascii-bitmaps doesn't accept ranges (use ASCII)."));
return 1;
}
else if (file_format == ASCII_BITMAPS)
{
sizeof (grub_uint32_t) * 2);
}
if (! output_file)
grub_util_error (_("no output file is specified"));
if (FT_Init_FreeType (&ft_lib))
grub_util_error (_("FT_Init_FreeType fails"));
{
int size;
if (err)
{
grub_printf (_("can't open file %s, index %d: error %d"),
else
printf ("\n");
continue;
}
if (! size)
{
(! ft_face->num_fixed_sizes))
else
}
}
{
int i;
for (i = 0; i < 0x10000; i++)
* sizeof (tmp[0]));
for (i = 0; i < 0x10000; i++)
* sizeof (font_info.glyphs_sorted[0]));
= *cur;
}
switch (file_format)
{
case PF2:
break;
case ASCII_BITMAPS:
break;
case WIDTH_SPEC:
break;
}
if (font_verbosity > 1)
return 0;
}