Preferences own some strings now.
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled
This commit is contained in:
@ -1197,7 +1197,7 @@ static CacheEntry_t *Cache_process_queue(CacheEntry_t *entry)
|
||||
entry->TypeHdr);
|
||||
TypeMismatch = true;
|
||||
}
|
||||
entry->TypeDet = dStrdup(Type);
|
||||
entry->TypeDet = Type;
|
||||
entry->Flags |= CA_GotContentType;
|
||||
} else
|
||||
return entry; /* i.e., wait for more data */
|
||||
|
||||
@ -213,11 +213,11 @@ static void checkFont(const char *name, const char *type)
|
||||
|
||||
static void checkPreferredFonts()
|
||||
{
|
||||
checkFont(prefs.font_sans_serif, "sans-serif");
|
||||
checkFont(prefs.font_serif, "serif");
|
||||
checkFont(prefs.font_monospace, "monospace");
|
||||
checkFont(prefs.font_cursive, "cursive");
|
||||
checkFont(prefs.font_fantasy, "fantasy");
|
||||
checkFont(prefs.font_sans_serif.c_str(), "sans-serif");
|
||||
checkFont(prefs.font_serif.c_str(), "serif");
|
||||
checkFont(prefs.font_monospace.c_str(), "monospace");
|
||||
checkFont(prefs.font_cursive.c_str(), "cursive");
|
||||
checkFont(prefs.font_fantasy.c_str(), "fantasy");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -428,7 +428,7 @@ int main(int argc, char **argv)
|
||||
checkPreferredFonts();
|
||||
|
||||
/* use preferred font for UI */
|
||||
Fl_Font defaultFont = dw::fltk::FltkFont::get (prefs.font_sans_serif, 0);
|
||||
Fl_Font defaultFont = dw::fltk::FltkFont::get (prefs.font_sans_serif.c_str(), 0);
|
||||
Fl::set_font(FL_HELVETICA, defaultFont); // this seems to be the
|
||||
// only way to set the
|
||||
// default font in fltk1.3
|
||||
|
||||
15
src/prefs.cc
15
src/prefs.cc
@ -45,15 +45,15 @@ void a_Prefs_init(void)
|
||||
prefs.contrast_visited_color = TRUE;
|
||||
prefs.enterpress_forces_submit = FALSE;
|
||||
prefs.focus_new_tab = FALSE;
|
||||
prefs.font_cursive = dStrdup(PREFS_FONT_CURSIVE);
|
||||
prefs.font_cursive = (PREFS_FONT_CURSIVE);
|
||||
prefs.font_factor = 1.0;
|
||||
prefs.zoom_factor = 1.0;
|
||||
prefs.font_max_size = 100;
|
||||
prefs.font_min_size = 6;
|
||||
prefs.font_fantasy = dStrdup(PREFS_FONT_FANTASY);
|
||||
prefs.font_monospace = dStrdup(PREFS_FONT_MONOSPACE);
|
||||
prefs.font_sans_serif = dStrdup(PREFS_FONT_SANS_SERIF);
|
||||
prefs.font_serif = dStrdup(PREFS_FONT_SERIF);
|
||||
prefs.font_fantasy = (PREFS_FONT_FANTASY);
|
||||
prefs.font_monospace = (PREFS_FONT_MONOSPACE);
|
||||
prefs.font_sans_serif = (PREFS_FONT_SANS_SERIF);
|
||||
prefs.font_serif = (PREFS_FONT_SERIF);
|
||||
prefs.fullwindow_start = FALSE;
|
||||
|
||||
/* these four constitute the geometry */
|
||||
@ -146,11 +146,6 @@ void a_Prefs_freeall(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
dFree(prefs.font_cursive);
|
||||
dFree(prefs.font_fantasy);
|
||||
dFree(prefs.font_monospace);
|
||||
dFree(prefs.font_sans_serif);
|
||||
dFree(prefs.font_serif);
|
||||
delete prefs.home;
|
||||
dFree(prefs.http_language);
|
||||
delete prefs.http_proxy;
|
||||
|
||||
15
src/prefs.hh
15
src/prefs.hh
@ -36,7 +36,8 @@ extern "C" {
|
||||
/** Panel sizes. */
|
||||
enum { P_tiny = 0, P_small, P_medium };
|
||||
|
||||
typedef struct {
|
||||
struct DilloPrefs
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
int xpos;
|
||||
@ -107,11 +108,11 @@ typedef struct {
|
||||
bool http_strict_transport_security;
|
||||
bool http_force_https;
|
||||
int32_t buffered_drawing;
|
||||
char *font_serif;
|
||||
char *font_sans_serif;
|
||||
char *font_cursive;
|
||||
char *font_fantasy;
|
||||
char *font_monospace;
|
||||
std::string font_serif;
|
||||
std::string font_sans_serif;
|
||||
std::string font_cursive;
|
||||
std::string font_fantasy;
|
||||
std::string font_monospace;
|
||||
bool enterpress_forces_submit;
|
||||
bool middle_click_opens_new_tab;
|
||||
bool right_click_closes_tab;
|
||||
@ -127,7 +128,7 @@ typedef struct {
|
||||
int penalty_em_dash_left, penalty_em_dash_right, penalty_em_dash_right_2;
|
||||
int stretchability_factor;
|
||||
Dlist *link_actions;
|
||||
} DilloPrefs;
|
||||
};
|
||||
|
||||
/** Global Data */
|
||||
extern DilloPrefs prefs;
|
||||
|
||||
@ -82,7 +82,7 @@ StyleEngine::StyleEngine (dw::core::Layout *layout,
|
||||
Node *n = &stack.back ();
|
||||
|
||||
/* Create a dummy font, attribute, and tag for the bottom of the stack. */
|
||||
font_attrs.name = prefs.font_sans_serif;
|
||||
font_attrs.name = prefs.font_sans_serif.c_str();
|
||||
font_attrs.size = roundInt(14 * prefs.font_factor * zoom);
|
||||
if (font_attrs.size < prefs.font_min_size)
|
||||
font_attrs.size = prefs.font_min_size;
|
||||
@ -356,7 +356,8 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props,
|
||||
BrowserWindow *bw) {
|
||||
FontAttrs fontAttrs = *attrs->font;
|
||||
Font *parentFont = stack.at (i - 1).style->font;
|
||||
char *c, *fontName;
|
||||
char *c;
|
||||
const char *fontName;
|
||||
int lineHeight;
|
||||
std::unique_ptr< DilloUrl > imgUrl;
|
||||
|
||||
@ -376,15 +377,15 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props,
|
||||
dStrstrip(p->value.strVal);
|
||||
|
||||
if (dStrAsciiCasecmp (p->value.strVal, "serif") == 0)
|
||||
fontName = prefs.font_serif;
|
||||
fontName = prefs.font_serif.c_str();
|
||||
else if (dStrAsciiCasecmp (p->value.strVal, "sans-serif") == 0)
|
||||
fontName = prefs.font_sans_serif;
|
||||
fontName = prefs.font_sans_serif.c_str();
|
||||
else if (dStrAsciiCasecmp (p->value.strVal, "cursive") == 0)
|
||||
fontName = prefs.font_cursive;
|
||||
fontName = prefs.font_cursive.c_str();
|
||||
else if (dStrAsciiCasecmp (p->value.strVal, "fantasy") == 0)
|
||||
fontName = prefs.font_fantasy;
|
||||
fontName = prefs.font_fantasy.c_str();
|
||||
else if (dStrAsciiCasecmp (p->value.strVal, "monospace") == 0)
|
||||
fontName = prefs.font_monospace;
|
||||
fontName = prefs.font_monospace.c_str();
|
||||
else if (Font::exists(layout, p->value.strVal))
|
||||
fontName = p->value.strVal;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user