Clean up framebuffer compile time font selection
Make framebuffer font documentation match reality Expose glyph cache size as a configuration option svn path=/trunk/netsurf/; revision=10871
This commit is contained in:
parent
409b3ef879
commit
84a0a62988
|
@ -79,26 +79,46 @@
|
||||||
The font glyphs are, by default, rendered as 256 level transparency
|
The font glyphs are, by default, rendered as 256 level transparency
|
||||||
which gives excellent visual results even on small font sizes.
|
which gives excellent visual results even on small font sizes.
|
||||||
|
|
||||||
The default font is the Vera trutype font set. The default path they
|
The default font is the DejaVu trutype font set. The default path they
|
||||||
are sourced from is /usr/share/fonts/truetype/ttf-bitstream-vera/ .
|
are sourced from is /usr/share/fonts/truetype/ttf-dejavu/ .
|
||||||
|
|
||||||
|
The compiled in default paths may be altered by setting values in
|
||||||
|
the user configuration makefile Makefile.config. These values must
|
||||||
|
be set to teh absolute path of the relevant font file including its
|
||||||
|
.ttf extension. The variables are:
|
||||||
|
|
||||||
|
NETSURF_FB_FONT_SANS_SERIF
|
||||||
|
NETSURF_FB_FONT_SANS_SERIF_BOLD
|
||||||
|
NETSURF_FB_FONT_SANS_SERIF_ITALIC
|
||||||
|
NETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD
|
||||||
|
NETSURF_FB_FONT_SERIF
|
||||||
|
NETSURF_FB_FONT_SERIF_BOLD
|
||||||
|
NETSURF_FB_FONT_MONOSPACE
|
||||||
|
NETSURF_FB_FONT_MONOSPACE_BOLD
|
||||||
|
NETSURF_FB_FONT_CURSIVE
|
||||||
|
NETSURF_FB_FONT_FANTASY
|
||||||
|
|
||||||
The font selection may be changed by placing truetype font files
|
The font selection may be changed by placing truetype font files
|
||||||
in the resources path. The resource files will be the generic names
|
in the resources path. The resource files will be the generic names
|
||||||
sans_serif.ttf, sans_serif_bold.ttf etc. The selection may also be
|
sans_serif.ttf, sans_serif_bold.ttf etc.
|
||||||
overridden by setting options.
|
|
||||||
|
|
||||||
The font system is configured at runtime by several options. The
|
The font system is configured at runtime by several options. The
|
||||||
fb_font_monochrome option causes the renderer to use monochrome
|
fb_font_monochrome option causes the renderer to use monochrome
|
||||||
glyph rendering which is faster to plot but slower to render and
|
glyph rendering which is faster to plot but slower to render and
|
||||||
much less visually appealing. The remaining seven options control
|
much less visually appealing.
|
||||||
the files to be used for font faces.
|
|
||||||
|
The remaining seven options control the files to be used for font faces.
|
||||||
|
|
||||||
fb_face_sans_serif - The sans serif face
|
fb_face_sans_serif - The sans serif face
|
||||||
fb_face_sans_serif_bold - The bold sans serif face
|
fb_face_sans_serif_bold - The bold sans serif face
|
||||||
fb_face_sans_serif_italic - The italic sans serif face
|
fb_face_sans_serif_italic - The italic sans serif face
|
||||||
fb_face_sans_serif_italic_bold - The bold italic sans serif face.
|
fb_face_sans_serif_italic_bold - The bold italic sans serif face.
|
||||||
fb_face_monospace - The monospaced font
|
|
||||||
fb_face_serif - The serif font
|
fb_face_serif - The serif font
|
||||||
fb_serif_bold - The bold serif font
|
fb_serif_bold - The bold serif font
|
||||||
|
fb_face_monospace - The monospaced font
|
||||||
|
fb_face_monospace_bold - The bold monospaced font
|
||||||
|
fb_face_cursive - The cursive font
|
||||||
|
fb_face_fantasy - The fantasy font
|
||||||
|
|
||||||
Old Freetype
|
Old Freetype
|
||||||
--------------
|
--------------
|
||||||
|
|
|
@ -155,27 +155,47 @@ Configuring
|
||||||
then several configuration options are available. If the simple
|
then several configuration options are available. If the simple
|
||||||
bitmap glyphs are used none of these options apply.
|
bitmap glyphs are used none of these options apply.
|
||||||
|
|
||||||
|
Font faces are provided for the css default styles of sans serif,
|
||||||
|
serif, monospace, cursive and fantasy. Only the sans serif
|
||||||
|
non-italic normal weight font is required to exist, If any of the
|
||||||
|
other faces are missing the sans serif font will be used instead.
|
||||||
|
|
||||||
|
The compiled in default font file paths are specified within the
|
||||||
|
build time Makefile.config. The default faces is the truetype DejaVu
|
||||||
|
font set in the directory /usr/share/fonts/truetype/ttf-dejavu/
|
||||||
|
|
||||||
The font glyphs are, by default, rendered as 256 level transparency
|
The font glyphs are, by default, rendered as 256 level transparency
|
||||||
which gives excellent visual results even on small font sizes.
|
which gives excellent visual results even on small font sizes.
|
||||||
|
|
||||||
The default font is the Vera truetype font set. The default path they
|
|
||||||
are sourced from is /usr/share/fonts/truetype/ttf-bitstream-vera/ .
|
|
||||||
|
|
||||||
The font selection may be changed by placing truetype font files
|
The font selection may be changed by placing truetype font files
|
||||||
in the resources path. The resource files will be the generic names
|
in the resources path. The resource files will be the generic names
|
||||||
sans_serif.ttf, sans_serif_bold.ttf etc. The selection may also be
|
sans_serif.ttf, sans_serif_bold.ttf etc.
|
||||||
overridden by setting options.
|
|
||||||
|
|
||||||
The font system is configured at run-time by several options. The
|
The font system is configured at run-time by several options:
|
||||||
fb_font_monochrome option causes the renderer to use monochrome
|
|
||||||
glyph rendering which is faster to plot but slower to render and
|
fb_font_monochrome
|
||||||
much less visually appealing. The remaining seven options control
|
This option causes the renderer to use monochrome glyph
|
||||||
the files to be used for font faces.
|
rendering. This method of rendering is much less visually
|
||||||
|
appealing and while faster to plot it is slower to render.
|
||||||
|
|
||||||
|
fb_font_cachesize
|
||||||
|
This option sets the number of kilobytes of memory set aside for
|
||||||
|
caching the rendered glyphs. This caching significantly improves
|
||||||
|
the performance of using the freetype rendering system. It is set
|
||||||
|
to 2048 by default (2 Megabytes of memory) which impiracle testing
|
||||||
|
shows to be a suitable value for the seven default faces.
|
||||||
|
|
||||||
|
The remaining options control the files to be used for font faces. The
|
||||||
|
font file name options will override both the compiled in paths and
|
||||||
|
files found in the resource path.
|
||||||
|
|
||||||
fb_face_sans_serif - The sans serif face
|
fb_face_sans_serif - The sans serif face
|
||||||
fb_face_sans_serif_bold - The bold sans serif face
|
fb_face_sans_serif_bold - The bold sans serif face
|
||||||
fb_face_sans_serif_italic - The italic sans serif face
|
fb_face_sans_serif_italic - The italic sans serif face
|
||||||
fb_face_sans_serif_italic_bold - The bold italic sans serif face.
|
fb_face_sans_serif_italic_bold - The bold italic sans serif face.
|
||||||
fb_face_monospace - The monospaced font
|
|
||||||
fb_face_serif - The serif font
|
fb_face_serif - The serif font
|
||||||
fb_serif_bold - The bold serif font
|
fb_face_serif_bold - The bold serif font
|
||||||
|
fb_face_monospace - The monospaced font
|
||||||
|
fb_face_monospace_bold - The bold monospaced font
|
||||||
|
fb_face_cursive - The cursive font
|
||||||
|
fb_face_fantasy - The fantasy font
|
||||||
|
|
17
Makefile
17
Makefile
|
@ -559,7 +559,22 @@ ifeq ($(TARGET),framebuffer)
|
||||||
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
|
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
|
||||||
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
|
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
|
||||||
|
|
||||||
CFLAGS += -Dnsframebuffer '-DNETSURF_FB_RESPATH="$(NETSURF_FB_RESPATH_$(NETSURF_FB_FRONTEND))"'
|
CFLAGS += -Dnsframebuffer
|
||||||
|
|
||||||
|
#resource path
|
||||||
|
CFLAGS += '-DNETSURF_FB_RESPATH="$(NETSURF_FB_RESPATH_$(NETSURF_FB_FRONTEND))"'
|
||||||
|
|
||||||
|
# compile time font locations
|
||||||
|
CFLAGS += '-DNETSURF_FB_FONT_SANS_SERIF="$(NETSURF_FB_FONT_SANS_SERIF)"'
|
||||||
|
CFLAGS += '-DNETSURF_FB_FONT_SANS_SERIF_BOLD="$(NETSURF_FB_FONT_SANS_SERIF_BOLD)"'
|
||||||
|
CFLAGS += '-DNETSURF_FB_FONT_SANS_SERIF_ITALIC="$(NETSURF_FB_FONT_SANS_SERIF_ITALIC)"'
|
||||||
|
CFLAGS += '-DNETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD="$(NETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD)"'
|
||||||
|
CFLAGS += '-DNETSURF_FB_FONT_SERIF="$(NETSURF_FB_FONT_SERIF)"'
|
||||||
|
CFLAGS += '-DNETSURF_FB_FONT_SERIF_BOLD="$(NETSURF_FB_FONT_SERIF_BOLD)"'
|
||||||
|
CFLAGS += '-DNETSURF_FB_FONT_MONOSPACE="$(NETSURF_FB_FONT_MONOSPACE)"'
|
||||||
|
CFLAGS += '-DNETSURF_FB_FONT_MONOSPACE_BOLD="$(NETSURF_FB_FONT_MONOSPACE_BOLD)"'
|
||||||
|
CFLAGS += '-DNETSURF_FB_FONT_CURSIVE="$(NETSURF_FB_FONT_CURSIVE)"'
|
||||||
|
CFLAGS += '-DNETSURF_FB_FONT_FANTASY="$(NETSURF_FB_FONT_FANTASY)"'
|
||||||
|
|
||||||
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
|
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
|
||||||
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
|
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
|
||||||
|
|
|
@ -232,9 +232,9 @@ ifeq ($(TARGET),framebuffer)
|
||||||
# Optimisation levels
|
# Optimisation levels
|
||||||
CFLAGS += -O2 -Wuninitialized
|
CFLAGS += -O2 -Wuninitialized
|
||||||
|
|
||||||
# Framebuffer frontend.
|
# Framebuffer default surface provider.
|
||||||
# Valid values are: linux, sdl, vnc, able
|
# Valid values are: x, sdl, linux, vnc, able,
|
||||||
NETSURF_FB_FRONTEND := linux
|
NETSURF_FB_FRONTEND := sdl
|
||||||
|
|
||||||
# Use libharu to enable PDF export and GTK printing support.
|
# Use libharu to enable PDF export and GTK printing support.
|
||||||
# Valid options: YES, NO
|
# Valid options: YES, NO
|
||||||
|
@ -248,12 +248,25 @@ ifeq ($(TARGET),framebuffer)
|
||||||
# Valid options: internal, freetype
|
# Valid options: internal, freetype
|
||||||
NETSURF_FB_FONTLIB := internal
|
NETSURF_FB_FONTLIB := internal
|
||||||
|
|
||||||
|
# freetype compiled in font locations
|
||||||
|
NETSURF_FB_FONT_SANS_SERIF := /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
|
||||||
|
NETSURF_FB_FONT_SANS_SERIF_BOLD := /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf
|
||||||
|
NETSURF_FB_FONT_SANS_SERIF_ITALIC := /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Oblique.ttf
|
||||||
|
NETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD := /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf
|
||||||
|
NETSURF_FB_FONT_SERIF := /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf
|
||||||
|
NETSURF_FB_FONT_SERIF_BOLD := /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf
|
||||||
|
NETSURF_FB_FONT_MONOSPACE := /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
|
||||||
|
NETSURF_FB_FONT_MONOSPACE_BOLD := /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf
|
||||||
|
NETSURF_FB_FONT_CURSIVE := /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf
|
||||||
|
NETSURF_FB_FONT_FANTASY := /usr/share/fonts/truetype/msttcorefonts/Impact.ttf
|
||||||
|
|
||||||
# Framebuffer frontends may have differing root paths for resources
|
# Framebuffer frontends may have differing root paths for resources
|
||||||
# As such, these specify the resource path and config path.
|
# As such, these specify the resource path and config path.
|
||||||
NETSURF_FB_RESPATH_linux := $(PREFIX)/share/netsurf/
|
NETSURF_FB_RESPATH_linux := $(PREFIX)/share/netsurf/
|
||||||
NETSURF_FB_RESPATH_able := (tftpboot)/
|
NETSURF_FB_RESPATH_able := (tftpboot)/
|
||||||
NETSURF_FB_RESPATH_dummy := ./
|
NETSURF_FB_RESPATH_dummy := ./
|
||||||
NETSURF_FB_RESPATH_sdl := $(PREFIX)/share/netsurf/
|
NETSURF_FB_RESPATH_sdl := $(PREFIX)/share/netsurf/
|
||||||
|
NETSURF_FB_RESPATH_x := $(PREFIX)/share/netsurf/
|
||||||
NETSURF_FB_RESPATH_vnc := $(PREFIX)/share/netsurf/
|
NETSURF_FB_RESPATH_vnc := $(PREFIX)/share/netsurf/
|
||||||
|
|
||||||
NETSURF_FRAMEBUFFER_RESOURCES = $(NETSURF_FB_RESPATH_$(NETSURF_FB_FRONTEND))
|
NETSURF_FRAMEBUFFER_RESOURCES = $(NETSURF_FB_RESPATH_$(NETSURF_FB_FRONTEND))
|
||||||
|
|
|
@ -34,7 +34,10 @@
|
||||||
#include "framebuffer/options.h"
|
#include "framebuffer/options.h"
|
||||||
#include "framebuffer/findfile.h"
|
#include "framebuffer/findfile.h"
|
||||||
|
|
||||||
#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
|
/* glyph cache minimum size */
|
||||||
|
#define CACHE_MIN_SIZE (100 * 1024)
|
||||||
|
|
||||||
|
#define BOLD_WEIGHT 700
|
||||||
|
|
||||||
static FT_Library library;
|
static FT_Library library;
|
||||||
static FTC_Manager ft_cmanager;
|
static FTC_Manager ft_cmanager;
|
||||||
|
@ -50,18 +53,23 @@ typedef struct fb_faceid_s {
|
||||||
int cidx; /* character map index for unicode */
|
int cidx; /* character map index for unicode */
|
||||||
} fb_faceid_t;
|
} fb_faceid_t;
|
||||||
|
|
||||||
|
|
||||||
|
enum fb_face_e {
|
||||||
|
FB_FACE_SANS_SERIF = 0,
|
||||||
|
FB_FACE_SANS_SERIF_BOLD = 1,
|
||||||
|
FB_FACE_SANS_SERIF_ITALIC = 2,
|
||||||
|
FB_FACE_SANS_SERIF_ITALIC_BOLD = 3,
|
||||||
|
FB_FACE_SERIF = 4,
|
||||||
|
FB_FACE_SERIF_BOLD = 5,
|
||||||
|
FB_FACE_MONOSPACE = 6,
|
||||||
|
FB_FACE_MONOSPACE_BOLD = 7,
|
||||||
|
FB_FACE_CURSIVE = 8,
|
||||||
|
FB_FACE_FANTASY = 9,
|
||||||
|
};
|
||||||
|
|
||||||
/* defines for accesing the faces */
|
/* defines for accesing the faces */
|
||||||
#define FB_FACE_DEFAULT 0
|
#define FB_FACE_DEFAULT 0
|
||||||
|
#define FB_FACE_COUNT 10
|
||||||
#define FB_FACE_SANS_SERIF 0
|
|
||||||
#define FB_FACE_SANS_SERIF_BOLD 1
|
|
||||||
#define FB_FACE_SANS_SERIF_ITALIC 2
|
|
||||||
#define FB_FACE_SANS_SERIF_ITALIC_BOLD 3
|
|
||||||
#define FB_FACE_MONOSPACE 4
|
|
||||||
#define FB_FACE_SERIF 5
|
|
||||||
#define FB_FACE_SERIF_BOLD 6
|
|
||||||
|
|
||||||
#define FB_FACE_COUNT 7
|
|
||||||
|
|
||||||
static fb_faceid_t *fb_faces[FB_FACE_COUNT];
|
static fb_faceid_t *fb_faces[FB_FACE_COUNT];
|
||||||
|
|
||||||
|
@ -124,7 +132,7 @@ fb_new_face(const char *option, const char *resname, const char *fontfile)
|
||||||
if (error) {
|
if (error) {
|
||||||
LOG(("Could not find font face %s (code %d)\n", fontfile, error));
|
LOG(("Could not find font face %s (code %d)\n", fontfile, error));
|
||||||
free(newf);
|
free(newf);
|
||||||
newf = fb_faces[FB_FACE_DEFAULT]; /* use default */
|
newf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return newf;
|
return newf;
|
||||||
|
@ -136,6 +144,7 @@ bool fb_font_init(void)
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
FT_ULong max_cache_size;
|
FT_ULong max_cache_size;
|
||||||
FT_UInt max_faces = 6;
|
FT_UInt max_faces = 6;
|
||||||
|
fb_faceid_t *fb_face;
|
||||||
|
|
||||||
/* freetype library initialise */
|
/* freetype library initialise */
|
||||||
error = FT_Init_FreeType( &library );
|
error = FT_Init_FreeType( &library );
|
||||||
|
@ -144,7 +153,12 @@ bool fb_font_init(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
max_cache_size = 2 * 1024 *1024; /* 2MB should be enough */
|
/* set the Glyph cache size up */
|
||||||
|
max_cache_size = option_fb_font_cachesize * 1024;
|
||||||
|
|
||||||
|
if (max_cache_size < CACHE_MIN_SIZE) {
|
||||||
|
max_cache_size = CACHE_MIN_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
/* cache manager initialise */
|
/* cache manager initialise */
|
||||||
error = FTC_Manager_New(library,
|
error = FTC_Manager_New(library,
|
||||||
|
@ -164,47 +178,122 @@ bool fb_font_init(void)
|
||||||
|
|
||||||
error = FTC_ImageCache_New(ft_cmanager, &ft_image_cache);
|
error = FTC_ImageCache_New(ft_cmanager, &ft_image_cache);
|
||||||
|
|
||||||
fb_faces[FB_FACE_SANS_SERIF] = NULL;
|
/* need to obtain the generic font faces */
|
||||||
fb_faces[FB_FACE_SANS_SERIF] =
|
|
||||||
fb_new_face(option_fb_face_sans_serif,
|
/* Start with the sans serif font */
|
||||||
|
fb_face = fb_new_face(option_fb_face_sans_serif,
|
||||||
"sans_serif.ttf",
|
"sans_serif.ttf",
|
||||||
DEJAVU_PATH"DejaVuSans.ttf");
|
NETSURF_FB_FONT_SANS_SERIF);
|
||||||
if (fb_faces[FB_FACE_SANS_SERIF] == NULL) {
|
if (fb_face == NULL) {
|
||||||
LOG(("Could not find default font (code %d)\n", error));
|
/* The sans serif font is the default and must be found. */
|
||||||
FTC_Manager_Done(ft_cmanager );
|
LOG(("Could not find the default font\n"));
|
||||||
|
FTC_Manager_Done(ft_cmanager);
|
||||||
FT_Done_FreeType(library);
|
FT_Done_FreeType(library);
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
|
fb_faces[FB_FACE_SANS_SERIF] = fb_face;
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_faces[FB_FACE_SANS_SERIF_BOLD] =
|
/* Bold sans serif face */
|
||||||
fb_new_face(option_fb_face_sans_serif_bold,
|
fb_face = fb_new_face(option_fb_face_sans_serif_bold,
|
||||||
"sans_serif_bold.ttf",
|
"sans_serif_bold.ttf",
|
||||||
DEJAVU_PATH"DejaVuSans-Bold.ttf");
|
NETSURF_FB_FONT_SANS_SERIF_BOLD);
|
||||||
|
if (fb_face == NULL) {
|
||||||
|
/* seperate bold face unavailabe use the normal weight version */
|
||||||
|
fb_faces[FB_FACE_SANS_SERIF_BOLD] = fb_faces[FB_FACE_SANS_SERIF];
|
||||||
|
} else {
|
||||||
|
fb_faces[FB_FACE_SANS_SERIF_BOLD] = fb_face;
|
||||||
|
}
|
||||||
|
|
||||||
fb_faces[FB_FACE_SANS_SERIF_ITALIC] =
|
/* Italic sans serif face */
|
||||||
fb_new_face(option_fb_face_sans_serif_italic,
|
fb_face = fb_new_face(option_fb_face_sans_serif_italic,
|
||||||
"sans_serif_italic.ttf",
|
"sans_serif_italic.ttf",
|
||||||
DEJAVU_PATH"DejaVuSans-Oblique.ttf");
|
NETSURF_FB_FONT_SANS_SERIF_ITALIC);
|
||||||
|
if (fb_face == NULL) {
|
||||||
|
/* seperate italic face unavailabe use the normal weight version */
|
||||||
|
fb_faces[FB_FACE_SANS_SERIF_ITALIC] = fb_faces[FB_FACE_SANS_SERIF];
|
||||||
|
} else {
|
||||||
|
fb_faces[FB_FACE_SANS_SERIF_ITALIC] = fb_face;
|
||||||
|
}
|
||||||
|
|
||||||
fb_faces[FB_FACE_SANS_SERIF_ITALIC_BOLD] =
|
/* Bold italic sans serif face */
|
||||||
fb_new_face(option_fb_face_sans_serif_italic_bold,
|
fb_face = fb_new_face(option_fb_face_sans_serif_italic_bold,
|
||||||
"sans_serif_italic_bold.ttf",
|
"sans_serif_italic_bold.ttf",
|
||||||
DEJAVU_PATH"DejaVuSans-BoldOblique.ttf");
|
NETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD);
|
||||||
|
if (fb_face == NULL) {
|
||||||
|
/* seperate italic face unavailabe use the normal weight version */
|
||||||
|
fb_faces[FB_FACE_SANS_SERIF_ITALIC_BOLD] = fb_faces[FB_FACE_SANS_SERIF];
|
||||||
|
} else {
|
||||||
|
fb_faces[FB_FACE_SANS_SERIF_ITALIC_BOLD] = fb_face;
|
||||||
|
}
|
||||||
|
|
||||||
fb_faces[FB_FACE_MONOSPACE] =
|
/* serif face */
|
||||||
fb_new_face(option_fb_face_monospace,
|
fb_face = fb_new_face(option_fb_face_serif,
|
||||||
"monospace.ttf",
|
|
||||||
DEJAVU_PATH"DejaVuSansMono.ttf");
|
|
||||||
|
|
||||||
fb_faces[FB_FACE_SERIF] =
|
|
||||||
fb_new_face(option_fb_face_serif,
|
|
||||||
"serif.ttf",
|
"serif.ttf",
|
||||||
DEJAVU_PATH"DejaVuSerif.ttf");
|
NETSURF_FB_FONT_SERIF);
|
||||||
|
if (fb_face == NULL) {
|
||||||
|
/* serif face unavailabe use the default */
|
||||||
|
fb_faces[FB_FACE_SERIF] = fb_faces[FB_FACE_SANS_SERIF];
|
||||||
|
} else {
|
||||||
|
fb_faces[FB_FACE_SERIF] = fb_face;
|
||||||
|
}
|
||||||
|
|
||||||
fb_faces[FB_FACE_SERIF_BOLD] =
|
/* bold serif face*/
|
||||||
fb_new_face(option_fb_face_serif_bold,
|
fb_face = fb_new_face(option_fb_face_serif_bold,
|
||||||
"serif_bold.ttf",
|
"serif_bold.ttf",
|
||||||
DEJAVU_PATH"DejaVuSerif-Bold.ttf");
|
NETSURF_FB_FONT_SERIF_BOLD);
|
||||||
|
if (fb_face == NULL) {
|
||||||
|
/* bold serif face unavailabe use the normal weight */
|
||||||
|
fb_faces[FB_FACE_SERIF_BOLD] = fb_faces[FB_FACE_SERIF];
|
||||||
|
} else {
|
||||||
|
fb_faces[FB_FACE_SERIF_BOLD] = fb_face;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* monospace face */
|
||||||
|
fb_face = fb_new_face(option_fb_face_monospace,
|
||||||
|
"monospace.ttf",
|
||||||
|
NETSURF_FB_FONT_MONOSPACE);
|
||||||
|
if (fb_face == NULL) {
|
||||||
|
/* serif face unavailabe use the default */
|
||||||
|
fb_faces[FB_FACE_MONOSPACE] = fb_faces[FB_FACE_SANS_SERIF];
|
||||||
|
} else {
|
||||||
|
fb_faces[FB_FACE_MONOSPACE] = fb_face;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* bold monospace face*/
|
||||||
|
fb_face = fb_new_face(option_fb_face_monospace_bold,
|
||||||
|
"monospace_bold.ttf",
|
||||||
|
NETSURF_FB_FONT_MONOSPACE_BOLD);
|
||||||
|
if (fb_face == NULL) {
|
||||||
|
/* bold serif face unavailabe use the normal weight */
|
||||||
|
fb_faces[FB_FACE_MONOSPACE_BOLD] = fb_faces[FB_FACE_MONOSPACE];
|
||||||
|
} else {
|
||||||
|
fb_faces[FB_FACE_MONOSPACE_BOLD] = fb_face;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cursive face */
|
||||||
|
fb_face = fb_new_face(option_fb_face_cursive,
|
||||||
|
"cursive.ttf",
|
||||||
|
NETSURF_FB_FONT_CURSIVE);
|
||||||
|
if (fb_face == NULL) {
|
||||||
|
/* cursive face unavailabe use the default */
|
||||||
|
fb_faces[FB_FACE_CURSIVE] = fb_faces[FB_FACE_SANS_SERIF];
|
||||||
|
} else {
|
||||||
|
fb_faces[FB_FACE_CURSIVE] = fb_face;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* fantasy face */
|
||||||
|
fb_face = fb_new_face(option_fb_face_fantasy,
|
||||||
|
"fantasy.ttf",
|
||||||
|
NETSURF_FB_FONT_FANTASY);
|
||||||
|
if (fb_face == NULL) {
|
||||||
|
/* fantasy face unavailabe use the default */
|
||||||
|
fb_faces[FB_FACE_FANTASY] = fb_faces[FB_FACE_SANS_SERIF];
|
||||||
|
} else {
|
||||||
|
fb_faces[FB_FACE_FANTASY] = fb_face;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* set the default render mode */
|
/* set the default render mode */
|
||||||
if (option_fb_font_monochrome == true)
|
if (option_fb_font_monochrome == true)
|
||||||
|
@ -227,39 +316,48 @@ static void fb_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
|
||||||
int selected_face = FB_FACE_DEFAULT;
|
int selected_face = FB_FACE_DEFAULT;
|
||||||
|
|
||||||
switch (fstyle->family) {
|
switch (fstyle->family) {
|
||||||
/*
|
|
||||||
case PLOT_FONT_FAMILY_CURSIVE:
|
|
||||||
break;
|
|
||||||
case PLOT_FONT_FAMILY_FANTASY:
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
case PLOT_FONT_FAMILY_SERIF:
|
|
||||||
if (fstyle->weight >= 700)
|
|
||||||
selected_face = FB_FACE_SERIF_BOLD;
|
|
||||||
else
|
|
||||||
selected_face = FB_FACE_SERIF;
|
|
||||||
|
|
||||||
|
case PLOT_FONT_FAMILY_SERIF:
|
||||||
|
if (fstyle->weight >= BOLD_WEIGHT) {
|
||||||
|
selected_face = FB_FACE_SERIF_BOLD;
|
||||||
|
} else {
|
||||||
|
selected_face = FB_FACE_SERIF;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLOT_FONT_FAMILY_MONOSPACE:
|
case PLOT_FONT_FAMILY_MONOSPACE:
|
||||||
|
if (fstyle->weight >= BOLD_WEIGHT) {
|
||||||
|
selected_face = FB_FACE_MONOSPACE_BOLD;
|
||||||
|
} else {
|
||||||
selected_face = FB_FACE_MONOSPACE;
|
selected_face = FB_FACE_MONOSPACE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PLOT_FONT_FAMILY_CURSIVE:
|
||||||
|
selected_face = FB_FACE_CURSIVE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PLOT_FONT_FAMILY_FANTASY:
|
||||||
|
selected_face = FB_FACE_FANTASY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLOT_FONT_FAMILY_SANS_SERIF:
|
case PLOT_FONT_FAMILY_SANS_SERIF:
|
||||||
default:
|
default:
|
||||||
if ((fstyle->flags & FONTF_ITALIC) ||
|
if ((fstyle->flags & FONTF_ITALIC) ||
|
||||||
(fstyle->flags & FONTF_OBLIQUE)) {
|
(fstyle->flags & FONTF_OBLIQUE)) {
|
||||||
if (fstyle->weight >= 700)
|
if (fstyle->weight >= BOLD_WEIGHT) {
|
||||||
selected_face = FB_FACE_SANS_SERIF_ITALIC_BOLD;
|
selected_face = FB_FACE_SANS_SERIF_ITALIC_BOLD;
|
||||||
else
|
|
||||||
selected_face = FB_FACE_SANS_SERIF_ITALIC;
|
|
||||||
} else {
|
} else {
|
||||||
if (fstyle->weight >= 700)
|
selected_face = FB_FACE_SANS_SERIF_ITALIC;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (fstyle->weight >= BOLD_WEIGHT) {
|
||||||
selected_face = FB_FACE_SANS_SERIF_BOLD;
|
selected_face = FB_FACE_SANS_SERIF_BOLD;
|
||||||
else
|
} else {
|
||||||
selected_face = FB_FACE_SANS_SERIF;
|
selected_face = FB_FACE_SANS_SERIF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
srec->face_id = (FTC_FaceID)fb_faces[selected_face];
|
srec->face_id = (FTC_FaceID)fb_faces[selected_face];
|
||||||
|
|
||||||
|
|
|
@ -21,25 +21,43 @@
|
||||||
|
|
||||||
#include "desktop/options.h"
|
#include "desktop/options.h"
|
||||||
|
|
||||||
|
/* surface options */
|
||||||
|
|
||||||
extern int option_fb_depth;
|
extern int option_fb_depth;
|
||||||
extern int option_fb_refresh;
|
extern int option_fb_refresh;
|
||||||
extern char *option_fb_device;
|
extern char *option_fb_device;
|
||||||
extern char *option_fb_input_devpath;
|
extern char *option_fb_input_devpath;
|
||||||
extern char *option_fb_input_glob;
|
extern char *option_fb_input_glob;
|
||||||
|
|
||||||
|
/* toolkit options */
|
||||||
|
|
||||||
extern int option_fb_furniture_size; /* toolkit furniture size */
|
extern int option_fb_furniture_size; /* toolkit furniture size */
|
||||||
extern int option_fb_toolbar_size; /* toolbar furniture size */
|
extern int option_fb_toolbar_size; /* toolbar furniture size */
|
||||||
extern char *option_fb_toolbar_layout; /* toolbar layout */
|
extern char *option_fb_toolbar_layout; /* toolbar layout */
|
||||||
extern bool option_fb_osk; /* enable on screen keyboard */
|
extern bool option_fb_osk; /* enable on screen keyboard */
|
||||||
|
|
||||||
extern bool option_fb_font_monochrome; /* render font monochrome */
|
/* font options */
|
||||||
|
|
||||||
|
/* render font monochrome */
|
||||||
|
extern bool option_fb_font_monochrome;
|
||||||
|
/** size of font glyph cache in kilobytes. */
|
||||||
|
extern int option_fb_font_cachesize;
|
||||||
|
|
||||||
extern char *option_fb_face_sans_serif; /* default sans face */
|
extern char *option_fb_face_sans_serif; /* default sans face */
|
||||||
extern char *option_fb_face_sans_serif_bold; /* bold sans face */
|
extern char *option_fb_face_sans_serif_bold; /* bold sans face */
|
||||||
extern char *option_fb_face_sans_serif_italic; /* bold sans face */
|
extern char *option_fb_face_sans_serif_italic; /* bold sans face */
|
||||||
extern char *option_fb_face_sans_serif_italic_bold; /* bold sans face */
|
extern char *option_fb_face_sans_serif_italic_bold; /* bold sans face */
|
||||||
extern char *option_fb_face_monospace; /* monospace face */
|
|
||||||
extern char *option_fb_face_serif; /* serif face */
|
extern char *option_fb_face_serif; /* serif face */
|
||||||
extern char *option_fb_face_serif_bold; /* bold serif face */
|
extern char *option_fb_face_serif_bold; /* bold serif face */
|
||||||
|
|
||||||
|
extern char *option_fb_face_monospace; /* monospace face */
|
||||||
|
extern char *option_fb_face_monospace_bold; /* bold monospace face */
|
||||||
|
|
||||||
|
extern char *option_fb_face_cursive; /* cursive face */
|
||||||
|
extern char *option_fb_face_fantasy; /* fantasy face */
|
||||||
|
|
||||||
|
|
||||||
#define EXTRA_OPTION_DEFINE \
|
#define EXTRA_OPTION_DEFINE \
|
||||||
int option_fb_depth = 32; \
|
int option_fb_depth = 32; \
|
||||||
int option_fb_refresh = 70; \
|
int option_fb_refresh = 70; \
|
||||||
|
@ -51,13 +69,17 @@ extern char *option_fb_face_serif_bold; /* bold serif face */
|
||||||
char *option_fb_toolbar_layout; \
|
char *option_fb_toolbar_layout; \
|
||||||
bool option_fb_osk = false; \
|
bool option_fb_osk = false; \
|
||||||
bool option_fb_font_monochrome = false; \
|
bool option_fb_font_monochrome = false; \
|
||||||
|
int option_fb_font_cachesize = 2048; \
|
||||||
char *option_fb_face_sans_serif; \
|
char *option_fb_face_sans_serif; \
|
||||||
char *option_fb_face_sans_serif_bold; \
|
char *option_fb_face_sans_serif_bold; \
|
||||||
char *option_fb_face_sans_serif_italic; \
|
char *option_fb_face_sans_serif_italic; \
|
||||||
char *option_fb_face_sans_serif_italic_bold; \
|
char *option_fb_face_sans_serif_italic_bold; \
|
||||||
char *option_fb_face_monospace; \
|
|
||||||
char *option_fb_face_serif; \
|
char *option_fb_face_serif; \
|
||||||
char *option_fb_face_serif_bold;
|
char *option_fb_face_serif_bold; \
|
||||||
|
char *option_fb_face_monospace; \
|
||||||
|
char *option_fb_face_monospace_bold; \
|
||||||
|
char *option_fb_face_cursive; \
|
||||||
|
char *option_fb_face_fantasy;
|
||||||
|
|
||||||
#define EXTRA_OPTION_TABLE \
|
#define EXTRA_OPTION_TABLE \
|
||||||
{ "fb_depth", OPTION_INTEGER, &option_fb_depth }, \
|
{ "fb_depth", OPTION_INTEGER, &option_fb_depth }, \
|
||||||
|
@ -70,13 +92,17 @@ extern char *option_fb_face_serif_bold; /* bold serif face */
|
||||||
{ "fb_toolbar_layout", OPTION_STRING, &option_fb_toolbar_layout }, \
|
{ "fb_toolbar_layout", OPTION_STRING, &option_fb_toolbar_layout }, \
|
||||||
{ "fb_osk", OPTION_BOOL, &option_fb_osk }, \
|
{ "fb_osk", OPTION_BOOL, &option_fb_osk }, \
|
||||||
{ "fb_font_monochrome", OPTION_BOOL, &option_fb_font_monochrome }, \
|
{ "fb_font_monochrome", OPTION_BOOL, &option_fb_font_monochrome }, \
|
||||||
|
{ "fb_font_cachesize", OPTION_INTEGER, &option_fb_font_cachesize }, \
|
||||||
{ "fb_face_sans_serif", OPTION_STRING, &option_fb_face_sans_serif }, \
|
{ "fb_face_sans_serif", OPTION_STRING, &option_fb_face_sans_serif }, \
|
||||||
{ "fb_face_sans_serif_bold", OPTION_STRING, &option_fb_face_sans_serif_bold }, \
|
{ "fb_face_sans_serif_bold", OPTION_STRING, &option_fb_face_sans_serif_bold }, \
|
||||||
{ "fb_face_sans_serif_italic", OPTION_STRING, &option_fb_face_sans_serif_italic }, \
|
{ "fb_face_sans_serif_italic", OPTION_STRING, &option_fb_face_sans_serif_italic }, \
|
||||||
{ "fb_face_sans_serif_italic_bold", OPTION_STRING, &option_fb_face_sans_serif_italic_bold }, \
|
{ "fb_face_sans_serif_italic_bold", OPTION_STRING, &option_fb_face_sans_serif_italic_bold }, \
|
||||||
{ "fb_face_monospace", OPTION_STRING, &option_fb_face_monospace }, \
|
|
||||||
{ "fb_face_serif", OPTION_STRING, &option_fb_face_serif }, \
|
{ "fb_face_serif", OPTION_STRING, &option_fb_face_serif }, \
|
||||||
{ "fb_serif_bold", OPTION_STRING, &option_fb_face_serif_bold }
|
{ "fb_serif_bold", OPTION_STRING, &option_fb_face_serif_bold }, \
|
||||||
|
{ "fb_face_monospace", OPTION_STRING, &option_fb_face_monospace }, \
|
||||||
|
{ "fb_face_monospace_bold", OPTION_STRING, &option_fb_face_monospace_bold }, \
|
||||||
|
{ "fb_face_cursive", OPTION_STRING, &option_fb_face_cursive }, \
|
||||||
|
{ "fb_face_fantasy", OPTION_STRING, &option_fb_face_fantasy }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue