If we want to have a GUI setting for forcing the font, I'm not against using the user-stylesheet-uri to do so, as it would definitely be the most effective solution here--no flashing, no extensions, and no javascript required. That said, I do think that user-stylesheet-uri should not be used directly, exactly because it's the most effective way to set global styles, and multiple components (including the end user) may want access to that ability. A midori component which multiplexed the property by keeping track of registered portions of the property and summed them into an actual value to use seems like it would work to make user-stylesheet-uri a reusable method of setting global style properties.
API could look something like
guint midori_settings_add_style_rule(MidoriWebSettings *settings, gchar *rule); //returns rule id, which is used to remove the rule later
midori_settings_remove_style_rule(MidoriWebSettings *settings, guint id); //removes the rule set with the given id
each of which would update the set of style rules and recalculate a resultant value for user-stylesheet-uri.
_midori_browser_forced_font could then be implemented as follows:
If we want to have a GUI setting for forcing the font, I'm not against using the user-stylesheet-uri to do so, as it would definitely be the most effective solution here--no flashing, no extensions, and no javascript required. That said, I do think that user-stylesheet-uri should not be used directly, exactly because it's the most effective way to set global styles, and multiple components (including the end user) may want access to that ability. A midori component which multiplexed the property by keeping track of registered portions of the property and summed them into an actual value to use seems like it would work to make user-stylesheet-uri a reusable method of setting global style properties.
API could look something like
guint midori_ settings_ add_style_ rule(MidoriWebS ettings *settings, gchar *rule); //returns rule id, which is used to remove the rule later settings_ remove_ style_rule( MidoriWebSettin gs *settings, guint id); //removes the rule set with the given id
midori_
each of which would update the set of style rules and recalculate a resultant value for user-stylesheet -uri.
_midori_ browser_ forced_ font could then be implemented as follows:
static void browser_ forced_ font (MidoriBrowser* browser, const gchar* family, gint size, gboolean enabled) ttings* midori_settings = browser->settings;
_midori_
{
MidoriWebSe
static guint rule_id = 0;
if (enabled)
g_string_ append_ printf (css_str, "%dpt ", size);
g_string_ append_ printf (css_str, "%s !important; }", family);
{
GString* css_str = g_string_new ("* { font: ");
rule_id = midori_ settings_ add_style_ rule (css_str->str);
}
else if (rule_id)
{
midori_
}
}