allow framebuffer port to use freetype2 library
svn path=/trunk/netsurf/; revision=6570
This commit is contained in:
parent
8aa291df0f
commit
0cecbe3cbc
5
Makefile
5
Makefile
|
@ -508,6 +508,11 @@ endif
|
|||
ifeq ($(TARGET),framebuffer)
|
||||
$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG support))
|
||||
|
||||
ifeq ($(NETSURF_FB_FONTLIB),freetype)
|
||||
CFLAGS += -DFB_USE_FREETYPE -I/usr/include/freetype2
|
||||
LDFLAGS += -lfreetype
|
||||
endif
|
||||
|
||||
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
|
||||
NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG
|
||||
NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
|
||||
|
|
|
@ -223,6 +223,10 @@ ifeq ($(TARGET),framebuffer)
|
|||
# Valid options: YES, NO
|
||||
NETSURF_USE_HARU_PDF := NO
|
||||
|
||||
# Library to use for font plotting
|
||||
# Valid options: internal, freetype
|
||||
NETSURF_FB_FONTLIB := internal
|
||||
|
||||
# Framebuffer frontends may have differing root paths for resources
|
||||
# As such, these specify the resource path and config path.
|
||||
NETSURF_FB_RESPATH_linux := /usr/share/netsurf/
|
||||
|
|
|
@ -92,12 +92,18 @@ S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
|
|||
|
||||
# S_FRAMEBUFFER are sources purely for the framebuffer build
|
||||
S_FRAMEBUFFER := fb_gui.c tree.c history.c hotlist.c fb_schedule.c \
|
||||
thumbnail.c misc.c fb_bitmap.c fb_font.c font_8x16.c \
|
||||
thumbnail.c misc.c fb_bitmap.c \
|
||||
fb_filetype.c login.c fb_cursor.c fb_plotters.c \
|
||||
fb_8bpp_plotters.c fb_16bpp_plotters.c fb_32bpp_plotters.c \
|
||||
fb_findfile.c fb_rootwindow.c fb_image_data.c
|
||||
# fb_1bpp_plotters.c
|
||||
|
||||
S_FRAMEBUFFER += fb_font_$(NETSURF_FB_FONTLIB).c
|
||||
|
||||
ifeq ($(NETSURF_FB_FONTLIB),internal)
|
||||
S_FRAMEBUFFER += font_8x16.c
|
||||
endif
|
||||
|
||||
ifeq ($(NETSURF_FB_FRONTEND),linux)
|
||||
S_FRAMEBUFFER += fb_frontend_linuxfb.c
|
||||
endif
|
||||
|
|
|
@ -191,7 +191,13 @@ static bool fb_16bpp_clg(colour c)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifdef FB_USE_FREETYPE
|
||||
static bool fb_16bpp_text(int x, int y, const struct css_style *style,
|
||||
const char *text, size_t length, colour bg, colour c)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
static bool fb_16bpp_text(int x, int y, const struct css_style *style,
|
||||
const char *text, size_t length, colour bg, colour c)
|
||||
{
|
||||
|
@ -278,6 +284,7 @@ static bool fb_16bpp_text(int x, int y, const struct css_style *style,
|
|||
free(buffer);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool fb_16bpp_disc(int x, int y, int radius, colour c, bool filled)
|
||||
{
|
||||
|
|
|
@ -178,7 +178,114 @@ static bool fb_32bpp_clg(colour c)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef FB_USE_FREETYPE
|
||||
|
||||
|
||||
static bool
|
||||
fb_32bpp_draw_ft_bitmap(FT_Bitmap *bp, int x, int y, colour c)
|
||||
{
|
||||
int height = bp->rows;
|
||||
int width = bp->width;
|
||||
uint32_t row;
|
||||
int xloop, yloop;
|
||||
|
||||
uint32_t *pvideo;
|
||||
uint32_t fgcol;
|
||||
|
||||
int x0,y0,x1,y1;
|
||||
int xoff, yoff; /* x and y offset into image */
|
||||
|
||||
unsigned char *fntd;
|
||||
|
||||
if (width == 0) {
|
||||
LOG(("null width char!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
y+=1; /* the coord is the bottom-left of the pixels offset by 1 to make
|
||||
* it work since fb coords are the top-left of pixels
|
||||
*/
|
||||
|
||||
/* The part of the text displayed is cropped to the current context. */
|
||||
x0 = x;
|
||||
y0 = y;
|
||||
x1 = x + width;
|
||||
y1 = y + height;
|
||||
|
||||
if (!fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1)) {
|
||||
return true; /* text lies outside current clipping region */
|
||||
}
|
||||
|
||||
/* find width and height to plot */
|
||||
if (height > (y1 - y0))
|
||||
height = (y1 - y0);
|
||||
|
||||
if (width > (x1 - x0))
|
||||
width = (x1 - x0);
|
||||
|
||||
xoff = x0 - x;
|
||||
yoff = y0 - y;
|
||||
|
||||
fgcol = ((c & 0xff0000) >> 16) | (c & 0xff00) | ((c & 0xff) << 16);
|
||||
|
||||
|
||||
pvideo = fb_32bpp_get_xy_loc(x, y0);
|
||||
|
||||
for (yloop = yoff; yloop < height; yloop++) {
|
||||
fntd = bp->buffer + (yloop * bp->pitch);
|
||||
for (xloop = 0; xloop < width ; xloop++) {
|
||||
if ((xloop % 8) == 0) {
|
||||
row = *fntd++;
|
||||
}
|
||||
|
||||
if ((row & 0x80) != 0) {
|
||||
*(pvideo + xloop) = fgcol;
|
||||
}
|
||||
row = row << 1;
|
||||
}
|
||||
|
||||
pvideo += (framebuffer->linelen >> 2);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool fb_32bpp_text(int x, int y, const struct css_style *style,
|
||||
const char *text, size_t length, colour bg, colour c)
|
||||
{
|
||||
uint32_t ucs4;
|
||||
size_t nxtchr = 0;
|
||||
FT_UInt glyph_index;
|
||||
FT_Face face = fb_get_face(style);
|
||||
FT_Error error;
|
||||
|
||||
while (nxtchr < length) {
|
||||
ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr);
|
||||
nxtchr = utf8_next(text, length, nxtchr);
|
||||
glyph_index = FT_Get_Char_Index(face, ucs4);
|
||||
|
||||
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
|
||||
if (error)
|
||||
continue;
|
||||
|
||||
error = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_MONO );
|
||||
if (error)
|
||||
continue;
|
||||
|
||||
/* now, draw to our target surface */
|
||||
fb_32bpp_draw_ft_bitmap( &face->glyph->bitmap,
|
||||
x + face->glyph->bitmap_left,
|
||||
y - face->glyph->bitmap_top,
|
||||
c);
|
||||
|
||||
x += face->glyph->advance.x >> 6;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
static bool fb_32bpp_text(int x, int y, const struct css_style *style,
|
||||
const char *text, size_t length, colour bg, colour c)
|
||||
{
|
||||
|
@ -259,17 +366,18 @@ static bool fb_32bpp_text(int x, int y, const struct css_style *style,
|
|||
free(buffer);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool fb_32bpp_disc(int x, int y, int radius, colour c, bool filled)
|
||||
{
|
||||
printf("disc\n");
|
||||
LOG(("disc unimplemented"));
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool fb_32bpp_arc(int x, int y, int radius, int angle1, int angle2,
|
||||
colour c)
|
||||
{
|
||||
printf("arc\n");
|
||||
LOG(("arc unimplemented"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -365,14 +473,14 @@ static bool fb_32bpp_bitmap_tile(int x, int y, int width, int height,
|
|||
|
||||
static bool fb_32bpp_flush(void)
|
||||
{
|
||||
printf("flush\n");
|
||||
LOG(("flush unimplemnted"));
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool fb_32bpp_path(const float *p, unsigned int n, colour fill, float width,
|
||||
colour c, const float transform[6])
|
||||
{
|
||||
printf("path\n");
|
||||
LOG(("path unimplemented"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,15 @@ static bool fb_8bpp_clg(colour c)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef FB_USE_FREETYPE
|
||||
|
||||
static bool fb_8bpp_text(int x, int y, const struct css_style *style,
|
||||
const char *text, size_t length, colour bg, colour c)
|
||||
{
|
||||
return false;
|
||||
|
||||
}
|
||||
#else
|
||||
static bool fb_8bpp_text(int x, int y, const struct css_style *style,
|
||||
const char *text, size_t length, colour bg, colour c)
|
||||
{
|
||||
|
@ -206,7 +215,7 @@ static bool fb_8bpp_text(int x, int y, const struct css_style *style,
|
|||
free(buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static bool fb_8bpp_disc(int x, int y, int radius, colour c, bool filled)
|
||||
{
|
||||
|
|
|
@ -19,6 +19,20 @@
|
|||
#ifndef NETSURF_FB_FONT_H
|
||||
#define NETSURF_FB_FONT_H
|
||||
|
||||
bool fb_font_init(void);
|
||||
bool fb_font_finalise(void);
|
||||
|
||||
#ifdef FB_USE_FREETYPE
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
FT_Face fb_get_face(const struct css_style *style);
|
||||
|
||||
#else
|
||||
|
||||
#include "utils/utf8.h"
|
||||
|
||||
struct fb_font_desc {
|
||||
const char *name;
|
||||
int width, height;
|
||||
|
@ -34,6 +48,7 @@ extern utf8_convert_ret utf8_to_font_encoding(const struct fb_font_desc* font,
|
|||
const char *string,
|
||||
size_t len,
|
||||
char **result);
|
||||
#endif
|
||||
|
||||
#endif /* NETSURF_FB_FONT_H */
|
||||
|
||||
|
|
|
@ -0,0 +1,260 @@
|
|||
/*
|
||||
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
|
||||
* 2008 Vincent Sanders <vince@simtec.co.uk>
|
||||
*
|
||||
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
||||
*
|
||||
* NetSurf is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* NetSurf 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "css/css.h"
|
||||
#include "render/font.h"
|
||||
#include "desktop/options.h"
|
||||
#include "utils/utf8.h"
|
||||
#include "utils/log.h"
|
||||
|
||||
#include "framebuffer/fb_gui.h"
|
||||
#include "framebuffer/fb_font.h"
|
||||
|
||||
static FT_Library library;
|
||||
static FT_Face face_sans_serif;
|
||||
|
||||
|
||||
utf8_convert_ret utf8_to_local_encoding(const char *string,
|
||||
size_t len,
|
||||
char **result)
|
||||
{
|
||||
return utf8_to_enc(string, "UTF-8", len, result);
|
||||
}
|
||||
|
||||
|
||||
/* initialise font handling */
|
||||
bool fb_font_init(void)
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
error = FT_Init_FreeType( &library );
|
||||
if (error) {
|
||||
LOG(("Freetype could not initialised (code %d)\n", error));
|
||||
return false;
|
||||
}
|
||||
|
||||
error = FT_New_Face(library,
|
||||
"/usr/share/fonts/truetype/freefont/FreeSans.ttf",
|
||||
0,
|
||||
&face_sans_serif );
|
||||
if (error) {
|
||||
LOG(("Could not find default font (code %d)\n", error));
|
||||
FT_Done_FreeType(library);
|
||||
return false;
|
||||
}
|
||||
|
||||
error = FT_Set_Pixel_Sizes(face_sans_serif, 0, 14 );
|
||||
if (error) {
|
||||
LOG(("Could not set pixel size (code %d)\n", error));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool fb_font_finalise(void)
|
||||
{
|
||||
FT_Done_FreeType(library);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_Face
|
||||
fb_get_face(const struct css_style *style)
|
||||
{
|
||||
FT_Face face;
|
||||
face = face_sans_serif;
|
||||
FT_Error error;
|
||||
int size;
|
||||
|
||||
if (style->font_size.value.length.unit == CSS_UNIT_PX) {
|
||||
size = style->font_size.value.length.value;
|
||||
|
||||
error = FT_Set_Pixel_Sizes(face_sans_serif, 0, size );
|
||||
if (error) {
|
||||
LOG(("Could not set pixel size (code %d)\n", error));
|
||||
}
|
||||
} else {
|
||||
size = css_len2pt(&style->font_size.value.length, style);
|
||||
error = FT_Set_Char_Size( face, 0, size*64, 72, 72 );
|
||||
if (error) {
|
||||
LOG(("Could not set pixel size (code %d)\n", error));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return face;
|
||||
}
|
||||
|
||||
/**
|
||||
* Measure the width of a string.
|
||||
*
|
||||
* \param style css_style for this text, with style->font_size.size ==
|
||||
* CSS_FONT_SIZE_LENGTH
|
||||
* \param string UTF-8 string to measure
|
||||
* \param length length of string
|
||||
* \param width updated to width of string[0..length)
|
||||
* \return true on success, false on error and error reported
|
||||
*/
|
||||
static bool nsfont_width(const struct css_style *style,
|
||||
const char *string, size_t length,
|
||||
int *width)
|
||||
{
|
||||
uint32_t ucs4;
|
||||
size_t nxtchr = 0;
|
||||
FT_UInt glyph_index;
|
||||
FT_Face face = fb_get_face(style);
|
||||
FT_Error error;
|
||||
|
||||
*width = 0;
|
||||
while (nxtchr < length) {
|
||||
ucs4 = utf8_to_ucs4(string + nxtchr, length - nxtchr);
|
||||
nxtchr = utf8_next(string, length, nxtchr);
|
||||
glyph_index = FT_Get_Char_Index(face, ucs4);
|
||||
|
||||
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
|
||||
if (error)
|
||||
continue;
|
||||
|
||||
*width += face->glyph->advance.x >> 6;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the position in a string where an x coordinate falls.
|
||||
*
|
||||
* \param style css_style for this text, with style->font_size.size ==
|
||||
* CSS_FONT_SIZE_LENGTH
|
||||
* \param string UTF-8 string to measure
|
||||
* \param length length of string
|
||||
* \param x x coordinate to search for
|
||||
* \param char_offset updated to offset in string of actual_x, [0..length]
|
||||
* \param actual_x updated to x coordinate of character closest to x
|
||||
* \return true on success, false on error and error reported
|
||||
*/
|
||||
|
||||
static bool nsfont_position_in_string(const struct css_style *style,
|
||||
const char *string, size_t length,
|
||||
int x, size_t *char_offset, int *actual_x)
|
||||
{
|
||||
uint32_t ucs4;
|
||||
size_t nxtchr = 0;
|
||||
FT_UInt glyph_index;
|
||||
FT_Face face = fb_get_face(style);
|
||||
FT_Error error;
|
||||
|
||||
*actual_x = 0;
|
||||
while (nxtchr < length) {
|
||||
ucs4 = utf8_to_ucs4(string + nxtchr, length - nxtchr);
|
||||
glyph_index = FT_Get_Char_Index(face, ucs4);
|
||||
|
||||
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
|
||||
if (error)
|
||||
continue;
|
||||
|
||||
*actual_x += face->glyph->advance.x >> 6;
|
||||
if (*actual_x > x)
|
||||
break;
|
||||
|
||||
nxtchr = utf8_next(string, length, nxtchr);
|
||||
}
|
||||
|
||||
*char_offset = nxtchr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find where to split a string to make it fit a width.
|
||||
*
|
||||
* \param style css_style for this text, with style->font_size.size ==
|
||||
* CSS_FONT_SIZE_LENGTH
|
||||
* \param string UTF-8 string to measure
|
||||
* \param length length of string
|
||||
* \param x width available
|
||||
* \param char_offset updated to offset in string of actual_x, [0..length]
|
||||
* \param actual_x updated to x coordinate of character closest to x
|
||||
* \return true on success, false on error and error reported
|
||||
*
|
||||
* On exit, [char_offset == 0 ||
|
||||
* string[char_offset] == ' ' ||
|
||||
* char_offset == length]
|
||||
*/
|
||||
|
||||
static bool nsfont_split(const struct css_style *style,
|
||||
const char *string, size_t length,
|
||||
int x, size_t *char_offset, int *actual_x)
|
||||
{
|
||||
uint32_t ucs4;
|
||||
size_t nxtchr = 0;
|
||||
FT_UInt glyph_index;
|
||||
FT_Face face = fb_get_face(style);
|
||||
FT_Error error;
|
||||
int last_space_x = -1;
|
||||
int last_space_idx = -1;
|
||||
|
||||
*actual_x = 0;
|
||||
while (nxtchr < length) {
|
||||
ucs4 = utf8_to_ucs4(string + nxtchr, length - nxtchr);
|
||||
|
||||
if (ucs4 == 0x20) {
|
||||
last_space_x = *actual_x;
|
||||
last_space_idx = nxtchr;
|
||||
}
|
||||
|
||||
glyph_index = FT_Get_Char_Index(face, ucs4);
|
||||
|
||||
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
|
||||
if (error)
|
||||
continue;
|
||||
|
||||
*actual_x += face->glyph->advance.x >> 6;
|
||||
if (*actual_x > x)
|
||||
break;
|
||||
|
||||
nxtchr = utf8_next(string, length, nxtchr);
|
||||
}
|
||||
|
||||
if (last_space_x == -1) {
|
||||
*char_offset = nxtchr;
|
||||
} else {
|
||||
*actual_x = last_space_x;
|
||||
*char_offset = last_space_idx;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const struct font_functions nsfont = {
|
||||
nsfont_width,
|
||||
nsfont_position_in_string,
|
||||
nsfont_split
|
||||
};
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* c-basic-offset:8
|
||||
* End:
|
||||
*/
|
|
@ -28,6 +28,11 @@
|
|||
#include "framebuffer/fb_gui.h"
|
||||
#include "framebuffer/fb_font.h"
|
||||
|
||||
bool fb_font_init(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const struct fb_font_desc*
|
||||
fb_get_font(const struct css_style *style)
|
||||
{
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2008 Vincent Sanders <vince@simtec.co.uk>
|
||||
*
|
||||
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
||||
*
|
||||
* NetSurf is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* NetSurf 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef NETSURF_FB_FONT_H
|
||||
#define NETSURF_FB_FONT_H
|
||||
|
||||
struct fb_font_desc {
|
||||
const char *name;
|
||||
int width, height;
|
||||
const char *encoding;
|
||||
const uint32_t *data;
|
||||
};
|
||||
|
||||
extern const struct fb_font_desc font_vga_8x16;
|
||||
|
||||
extern const struct fb_font_desc* fb_get_font(const struct css_style *style);
|
||||
|
||||
extern utf8_convert_ret utf8_to_font_encoding(const struct fb_font_desc* font,
|
||||
const char *string,
|
||||
size_t len,
|
||||
char **result);
|
||||
|
||||
#endif /* NETSURF_FB_FONT_H */
|
||||
|
|
@ -49,6 +49,7 @@
|
|||
#include "framebuffer/fb_cursor.h"
|
||||
#include "framebuffer/fb_frontend.h"
|
||||
#include "framebuffer/fb_options.h"
|
||||
#include "framebuffer/fb_rootwindow.h"
|
||||
|
||||
#include "utils/log.h"
|
||||
#include "utils/messages.h"
|
||||
|
@ -647,15 +648,11 @@ void fb_os_input(struct gui_window *g, bool active)
|
|||
} else if (event.type == EV_REL) {
|
||||
switch (event.code) {
|
||||
case 0:
|
||||
fb_cursor_move(framebuffer,
|
||||
event.value,
|
||||
0);
|
||||
fb_rootwindow_move(framebuffer, g, event.value, 0, true);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
fb_cursor_move(framebuffer,
|
||||
0,
|
||||
event.value);
|
||||
fb_rootwindow_move(framebuffer, g, 0, event.value, true);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "framebuffer/fb_findfile.h"
|
||||
#include "framebuffer/fb_rootwindow.h"
|
||||
#include "framebuffer/fb_image_data.h"
|
||||
#include "framebuffer/fb_font.h"
|
||||
|
||||
#include "content/urldb.h"
|
||||
#include "desktop/history_core.h"
|
||||
|
@ -225,6 +226,9 @@ void gui_init(int argc, char** argv)
|
|||
}
|
||||
|
||||
framebuffer->cursor = fb_cursor_init(framebuffer, &pointer_image);
|
||||
|
||||
fb_font_init();
|
||||
|
||||
}
|
||||
|
||||
void gui_init2(int argc, char** argv)
|
||||
|
@ -542,7 +546,7 @@ bool gui_window_box_scroll_start(struct gui_window *g,
|
|||
|
||||
bool gui_window_frame_resize_start(struct gui_window *g)
|
||||
{
|
||||
printf("resize frame\n");
|
||||
LOG(("resize frame\n"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -552,7 +556,7 @@ void gui_window_save_as_link(struct gui_window *g, struct content *c)
|
|||
|
||||
void gui_window_set_scale(struct gui_window *g, float scale)
|
||||
{
|
||||
printf("set scale\n");
|
||||
LOG(("set scale\n"));
|
||||
}
|
||||
|
||||
struct gui_download_window *gui_download_window_create(const char *url,
|
||||
|
|
|
@ -79,6 +79,8 @@ struct fb_widget {
|
|||
char* text;
|
||||
};
|
||||
|
||||
static struct css_style root_style;
|
||||
|
||||
static struct fb_widget *widget_list;
|
||||
|
||||
/* widget for status */
|
||||
|
@ -141,7 +143,7 @@ fb_redraw_widget(struct fb_widget *widget)
|
|||
if (widget->text != NULL) {
|
||||
plot.text(fb_plot_ctx.x0 + 2,
|
||||
fb_plot_ctx.y0 + 15,
|
||||
NULL,
|
||||
&root_style,
|
||||
widget->text,
|
||||
strlen(widget->text),
|
||||
widget->bg,
|
||||
|
@ -383,6 +385,10 @@ void fb_rootwindow_create(framebuffer_t *fb)
|
|||
/* no widget yet has input */
|
||||
inputfocus_widget = NULL;
|
||||
|
||||
/* setup root css style (for text etc.) */
|
||||
root_style.font_size.value.length.unit = CSS_UNIT_PX;
|
||||
root_style.font_size.value.length.value = 14;
|
||||
|
||||
/* underlying root window, cannot take input and lowest in stack */
|
||||
rootwindow = calloc(1, sizeof(struct gui_window));
|
||||
rootwindow->x = 0;
|
||||
|
|
Loading…
Reference in New Issue