summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dillo.cc4
-rw-r--r--src/form.cc2
-rw-r--r--src/html.cc2
-rw-r--r--src/prefs.c6
-rw-r--r--src/prefs.h2
-rw-r--r--src/prefsparser.cc25
6 files changed, 38 insertions, 3 deletions
diff --git a/src/dillo.cc b/src/dillo.cc
index 173ac036..9bab589c 100644
--- a/src/dillo.cc
+++ b/src/dillo.cc
@@ -50,6 +50,7 @@
#include "auth.h"
#include "dw/fltkcore.hh"
+#include "dw/textblock.hh"
/*
* Command line options structure
@@ -359,6 +360,9 @@ int main(int argc, char **argv)
a_Cookies_init();
a_Auth_init();
+ dw::Textblock::setPenaltyHyphen (prefs.penalty_hyphen);
+ dw::Textblock::setPenaltyHyphen2 (prefs.penalty_hyphen_2);
+
/* command line options override preferences */
if (options_got & DILLO_CLI_FULLWINDOW)
prefs.fullwindow_start = TRUE;
diff --git a/src/form.cc b/src/form.cc
index d5bd71da..92e06ab1 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -870,7 +870,7 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize)
html->styleEngine->setNonCssHint (PROPERTY_X_TOOLTIP, CSS_TYPE_STRING,
attrbuf);
}
- /* We used to have Textblock (prefs.limit_text_width) here,
+ /* We used to have Textblock (prefs.limit_text_width, ...) here,
* but it caused 100% CPU usage.
*/
page = new Textblock (false);
diff --git a/src/html.cc b/src/html.cc
index 0efe1bbf..44023e37 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -458,7 +458,7 @@ void DilloHtml::initDw()
dReturn_if_fail (dw == NULL);
/* Create the main widget */
- dw = stack->getRef(0)->textblock = new Textblock (prefs.limit_text_width);
+ dw = stack->getRef(0)->textblock = new Textblock (prefs.limit_text_width);
bw->num_page_bugs = 0;
dStr_truncate(bw->page_bugs, 0);
diff --git a/src/prefs.c b/src/prefs.c
index a7fa1bcf..88d10a8d 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -101,6 +101,12 @@ void a_Prefs_init(void)
prefs.start_page = a_Url_new(PREFS_START_PAGE, NULL);
prefs.theme = dStrdup(PREFS_THEME);
prefs.w3c_plus_heuristics = TRUE;
+
+ prefs.penalty_hyphen = 100;
+ prefs.penalty_hyphen_2 = 100;
+ prefs.penalty_em_dash_left = 800;
+ prefs.penalty_em_dash_right = 100;
+ prefs.penalty_em_dash_right_2 = 800;
}
/*
diff --git a/src/prefs.h b/src/prefs.h
index 7622aea3..0c392ae5 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -89,6 +89,8 @@ struct _DilloPrefs {
bool_t show_msg;
bool_t show_extra_warnings;
bool_t middle_click_drags_page;
+ int penalty_hyphen, penalty_hyphen_2;
+ int penalty_em_dash_left, penalty_em_dash_right, penalty_em_dash_right_2;
};
/* Global Data */
diff --git a/src/prefsparser.cc b/src/prefsparser.cc
index aa810b1e..6eb8c11d 100644
--- a/src/prefsparser.cc
+++ b/src/prefsparser.cc
@@ -12,6 +12,8 @@
#include <sys/types.h>
#include <stdlib.h>
#include <locale.h> /* for setlocale */
+#include <math.h> /* for isinf */
+#include <limits.h>
#include "prefs.h"
#include "misc.h"
@@ -28,6 +30,7 @@ typedef enum {
PREFS_URL,
PREFS_INT32,
PREFS_DOUBLE,
+ PREFS_FRACTION_100,
PREFS_GEOMETRY,
PREFS_PANEL_SIZE
} PrefType_t;
@@ -107,7 +110,15 @@ int PrefsParser::parseOption(char *name, char *value)
{ "small_icons", &prefs.small_icons, PREFS_BOOL },
{ "start_page", &prefs.start_page, PREFS_URL },
{ "theme", &prefs.theme, PREFS_STRING },
- { "w3c_plus_heuristics", &prefs.w3c_plus_heuristics, PREFS_BOOL }
+ { "w3c_plus_heuristics", &prefs.w3c_plus_heuristics, PREFS_BOOL },
+ { "penalty_hyphen", &prefs.penalty_hyphen, PREFS_FRACTION_100 },
+ { "penalty_hyphen_2", &prefs.penalty_hyphen_2, PREFS_FRACTION_100 },
+ { "penalty_em_dash_left", &prefs.penalty_em_dash_left,
+ PREFS_FRACTION_100 },
+ { "penalty_em_dash_right", &prefs.penalty_em_dash_right,
+ PREFS_FRACTION_100 },
+ { "penalty_em_dash_right_2", &prefs.penalty_em_dash_right_2,
+ PREFS_FRACTION_100 }
};
node = NULL;
@@ -160,6 +171,18 @@ int PrefsParser::parseOption(char *name, char *value)
case PREFS_DOUBLE:
*(double *)node->pref = strtod(value, NULL);
break;
+ case PREFS_FRACTION_100:
+ {
+ double d = strtod (value, NULL);
+ if (isinf(d)) {
+ if (d > 0)
+ *(int*)node->pref = INT_MAX;
+ else
+ *(int*)node->pref = INT_MIN;
+ } else
+ *(int*)node->pref = 100 * d;
+ }
+ break;
case PREFS_GEOMETRY:
a_Misc_parse_geometry(value, &prefs.xpos, &prefs.ypos,
&prefs.width, &prefs.height);