font.c revision 2
/* font.c - Font API and font file loader. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2006,2007,2008,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 <grub/fontformat.h>
#include <grub/gfxmenu_view.h>
/* Draw a UTF-8 string of text on the current video render target.
The x coordinate specifies the starting x position for the first character,
while the y coordinate specifies the baseline position.
If the string contains a character that FONT does not contain, then
a glyph from another loaded font may be used instead. */
int left_x, int baseline_y)
{
int x;
struct grub_font_glyph *glyph;
if (logical_len < 0)
return grub_errno;
0, 0, 0);
if (visual_len < 0)
return grub_errno;
{
if (!glyph)
return grub_errno;
x += glyph->device_width;
if (err)
return err;
}
return GRUB_ERR_NONE;
}
/* Get the width in pixels of the specified UTF-8 string, when rendered in
in the specified font (but falling back on other fonts for glyphs that
are missing). */
int
{
int width = 0;
if (logical_len < 0)
{
return 0;
}
{
struct grub_unicode_glyph glyph;
&glyph);
}
return width;
}