Implement bold and italic font rendering for Unicode display and make it the default.

svn path=/trunk/netsurf/; revision=6155
This commit is contained in:
Chris Young 2009-01-20 16:53:06 +00:00
parent c5f72605b4
commit 161dea3d8b
5 changed files with 84 additions and 22 deletions

View File

@ -44,7 +44,7 @@ The options file is stored in @{"Resources/Options" link Resources/Options/Main}
@{b}recent_file@{ub} Path to file to store recent history list
@{b}arexx_dir@{ub} Path to ARexx scripts dir
@{b}download_dir@{ub} default download destination
@{b}quick_text@{ub} disable for experimental Unicode display
@{b}quick_text@{ub} enable for local charset text only (not recommended)
@{b}delay_redraw@{ub} slows down redraw interval
@endnode

View File

@ -2,9 +2,9 @@ Short: Fast CSS capable web browser
Uploader: chris@unsatisfactorysoftware.co.uk (Chris Young)
Author: NetSurf contributors (OS4 port by Chris Young)
Type: comm/www
Version: 2.0 development (SVN 5591)
Version: 2.0 development (SVN 5911)
Architecture: ppc-amigaos >= 4.0.0
Requires: AISS, dev/c/pthreads.lha
Requires: AISS
This is a preview release of the OS4 native port of NetSurf.
It is beta software, which means it is unstable and missing
@ -14,6 +14,9 @@ This is provided for testing purposes only, to gain feedback
in order to fix bugs for the real release and to prioritise
features.
IF YOU UPDATE AN OLDER VERSION YOU MAY NEED TO ADD
screen_depth:32 TO YOUR RESOURCES/OPTIONS FILE
Please report bugs to chris@unsatisfactorysoftware.co.uk,
on the Amigans.net forums or in the bug tracker at
http://www.unsatisfactorysoftware.co.uk/bugs (the bug tracker

View File

@ -35,8 +35,12 @@
#include "amiga/options.h"
#include <parserutils/charset/utf8.h>
#include <parserutils/charset/utf16.h>
#include <proto/utility.h>
static struct OutlineFont *of[CSS_FONT_FAMILY_NOT_SET];
static struct OutlineFont *ofb[CSS_FONT_FAMILY_NOT_SET];
static struct OutlineFont *ofi[CSS_FONT_FAMILY_NOT_SET];
static struct OutlineFont *ofbi[CSS_FONT_FAMILY_NOT_SET];
struct OutlineFont *ami_open_outline_font(struct css_style *style);
@ -382,10 +386,45 @@ struct OutlineFont *ami_open_outline_font(struct css_style *style)
struct OutlineFont *ofont;
char *fontname;
WORD ysize;
int tstyle = 0;
ofont = of[style->font_family];
switch(style->font_style)
{
case CSS_FONT_STYLE_ITALIC:
case CSS_FONT_STYLE_OBLIQUE:
tstyle += NSA_ITALIC;
break;
}
/* see diskfont implementation for currently unimplemented bold/italic stuff */
switch(style->font_weight)
{
case CSS_FONT_WEIGHT_BOLD:
case CSS_FONT_WEIGHT_BOLDER:
tstyle += NSA_BOLD;
break;
}
switch(tstyle)
{
case NSA_ITALIC:
if(ofi[style->font_family]) ofont = ofi[style->font_family];
else ofont = of[style->font_family];
break;
case NSA_BOLD:
if(ofb[style->font_family]) ofont = ofb[style->font_family];
else ofont = of[style->font_family];
break;
case NSA_BOLDITALIC:
if(ofbi[style->font_family]) ofont = ofbi[style->font_family];
else ofont = of[style->font_family];
break;
default:
ofont = of[style->font_family];
break;
}
ysize = css_len2pt(&style->font_size.value.length, style);
@ -498,25 +537,37 @@ void ami_init_fonts(void)
of[CSS_FONT_FAMILY_UNKNOWN] = OpenOutlineFont(option_font_sans,NULL,OFF_OPEN);
of[CSS_FONT_FAMILY_NOT_SET] = OpenOutlineFont(option_font_sans,NULL,OFF_OPEN);
#if 0
for(i=CSS_FONT_FAMILY_SANS_SERIF;i<=CSS_FONT_FAMILY_NOT_SET;i++)
{
if(EObtainInfo(&of[i]->olf_EEngine,
OT_BName,&bname,
OT_IName,&iname,
OT_BIName,&biname,
TAG_END) == 0)
{
printf("%s\n",bname);
if(!of[i]) warn_user("FontError",""); // temporary error message
EReleaseInfo(&of[i]->olf_EEngine,
OT_BName,bname,
OT_IName,iname,
OT_BIName,biname,
TAG_END);
if(bname = GetTagData(OT_BName,0,of[i]->olf_OTagList))
{
ofb[i] = OpenOutlineFont(bname,NULL,OFF_OPEN);
}
else
{
ofb[i] = NULL;
}
if(iname = GetTagData(OT_IName,0,of[i]->olf_OTagList))
{
ofi[i] = OpenOutlineFont(iname,NULL,OFF_OPEN);
}
else
{
ofi[i] = NULL;
}
if(biname = GetTagData(OT_BIName,0,of[i]->olf_OTagList))
{
ofbi[i] = OpenOutlineFont(biname,NULL,OFF_OPEN);
}
else
{
ofbi[i] = NULL;
}
}
#endif
}
}
@ -526,9 +577,12 @@ void ami_close_fonts(void)
if(!option_quick_text)
{
for(i=0;i<=CSS_FONT_FAMILY_NOT_SET;i++)
for(i=CSS_FONT_FAMILY_SANS_SERIF;i<=CSS_FONT_FAMILY_NOT_SET;i++)
{
if(of[i]) CloseOutlineFont(of[i],NULL);
if(ofb[i]) CloseOutlineFont(ofb[i],NULL);
if(ofi[i]) CloseOutlineFont(ofi[i],NULL);
if(ofbi[i]) CloseOutlineFont(ofbi[i],NULL);
}
}
}

View File

@ -22,6 +22,11 @@
#include "css/css.h"
#include <graphics/text.h>
#define NSA_NORMAL 0
#define NSA_ITALIC 1
#define NSA_BOLD 2
#define NSA_BOLDITALIC 3
struct TextFont *ami_open_font(struct css_style *);
void ami_close_font(struct TextFont *tfont);
ULONG ami_unicode_text(struct RastPort *rp,char *string,ULONG length,struct css_style *style,ULONG x,ULONG y,ULONG c);

View File

@ -60,8 +60,8 @@ bool option_kiosk_mode = false; \
char *option_recent_file = 0; \
char *option_arexx_dir = 0; \
char *option_download_dir = 0; \
bool option_quick_text = true; \
bool option_redraw_on_intuiticks = true; \
bool option_quick_text = false; \
bool option_redraw_on_intuiticks = false; \
#define EXTRA_OPTION_TABLE \
{ "verbose_log", OPTION_BOOL, &option_verbose_log}, \