Re: hyphenation in dillo

Johannes Hofmann <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
Hi Jorge,

On Wed, Sep 05, 2012 at 02:30:32PM -0300, Jorge Arellano Cid wrote:
> On Tue, Sep 04, 2012 at 08:55:19PM +0200, Johannes Hofmann wrote:
> > On Tue, Sep 04, 2012 at 06:46:30PM +0200, Sebastian Geerken wrote:
> > > On Tue, Sep 04, Johannes Hofmann wrote:
> > > > On Tue, Sep 04, 2012 at 02:36:29PM +0200, Sebastian Geerken wrote:
> > > > > > I'm mostly finished with cleaning up the calculation of extremes (used
> > > > > > for tables). This should already work now, please test it again.
> > > > > 
> > > > > Just pushed some more changes; should be complete now. Please test
> > > > > thoroughly.
> 
>   Several sites I visit don't trigger hyphenation because they lack
> the "lang" attribute. I'm experimenting with a very simple language 
> guess routine, to get an idea of how it could help in this regard.
> 
>   @Johannes, This function samples text from the parser, and it may
> fall anywhere on the CSS tree. How can I set it for the HTML element so
> it is inherited from there?

Fancy! Unfortunately you probabely only know the language of an
element, after you've seen text from it. That's too late. You would
need to do the setNonCssHint() before the first call to getStyle()
on that element.
So basically you would need to somehow remember the language for
each element and then reload and set the appropriate language
for the element - but I agree that that's not really elegant.

> 
>   I've tried:
> 
>      html->styleEngine->setNonCssHint(
>         PROPERTY_X_LANG, CSS_TYPE_STRING, html->lang);
> 
>      which seems to set it for the current element only.
> 
>   and
> 
>      html->styleEngine->restyle ();
> 
>   with no good result.

Yeah, I fear restyle() does not what you need here.

For now we could simply expose x-lang to the css parser, so you can
at least set a reasonable default (e.g. body { x-lang:"en"  } )in
your ~/.dillo/style.css (see attached patch against dillo_hyphenation).

Cheers,
Johannes

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
dillo_css_lang.diff (text/plain, 989 B)
diff -r 187eaa2c4af9 src/css.hh
--- a/src/css.hh	Wed Sep 05 15:02:03 2012 +0200
+++ b/src/css.hh	Wed Sep 05 20:28:24 2012 +0200
@@ -218,12 +218,12 @@
    CSS_PROPERTY_WHITE_SPACE,
    CSS_PROPERTY_WIDTH,
    CSS_PROPERTY_WORD_SPACING,
+   PROPERTY_X_LANG,
    CSS_PROPERTY_Z_INDEX,
    CSS_PROPERTY_X_LINK,
    CSS_PROPERTY_X_COLSPAN,
    CSS_PROPERTY_X_ROWSPAN,
    PROPERTY_X_LINK,
-   PROPERTY_X_LANG,
    PROPERTY_X_IMG,
    PROPERTY_X_TOOLTIP,
    CSS_PROPERTY_LAST
diff -r 187eaa2c4af9 src/cssparser.cc
--- a/src/cssparser.cc	Wed Sep 05 15:02:03 2012 +0200
+++ b/src/cssparser.cc	Wed Sep 05 20:28:24 2012 +0200
@@ -242,6 +242,7 @@
    {"width", {CSS_TYPE_LENGTH_PERCENTAGE, CSS_TYPE_UNUSED}, NULL},
    {"word-spacing", {CSS_TYPE_ENUM, CSS_TYPE_SIGNED_LENGTH, CSS_TYPE_UNUSED},
     Css_word_spacing_enum_vals},
+   {"x-lang", {CSS_TYPE_STRING, CSS_TYPE_UNUSED}, NULL},
    {"z-index", {CSS_TYPE_UNUSED}, NULL},
 
    /* These are extensions, for internal used, and never parsed. */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.