unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* EWW: Face property changes around newlines
@ 2019-01-08 21:41 T.V Raman
  2019-01-09 14:35 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: T.V Raman @ 2019-01-08 21:41 UTC (permalink / raw)
  To: emacs-devel; +Cc: bug-gnu-emacs

In general, font-lock in emacs tends to set properties  like so:

If you have a doc string that is multiline, the whitespace in that
comment -- including the newline chars-- get the  same font/face property.

EWW appears to work differently -- if you take a plain paragraph that
spans multiple lines, the text uses "variable-pitch" as  the face
property -- except that that property is not set on the newline
characters within the paragraph. 

I'm sure this makes no visible difference to the layout -- but it
affects Emacspeak's logic for breaking content into meaningful
clauses. Could EWW be made consistent with the rest of Emacs' font-lock
in this regard?
-- 
Id: kg:/m/0285kf1 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: EWW: Face property changes around newlines
  2019-01-08 21:41 EWW: Face property changes around newlines T.V Raman
@ 2019-01-09 14:35 ` Stefan Monnier
  2019-01-09 15:01   ` T.V Raman
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2019-01-09 14:35 UTC (permalink / raw)
  To: emacs-devel; +Cc: bug-gnu-emacs

> EWW appears to work differently -- if you take a plain paragraph that
> spans multiple lines, the text uses "variable-pitch" as  the face
> property -- except that that property is not set on the newline
> characters within the paragraph.

I'm not sure how hard/easy it may be to change SHR (used by EWW) to do
that, but I have the impression that it may be non-trivial.

> I'm sure this makes no visible difference to the layout -- but it
> affects Emacspeak's logic for breaking content into meaningful
> clauses.

Maybe it would be simpler to change Emacspeak so it ignores face
properties on whitespace?


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: EWW: Face property changes around newlines
  2019-01-09 14:35 ` Stefan Monnier
@ 2019-01-09 15:01   ` T.V Raman
  2019-01-09 21:15     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: T.V Raman @ 2019-01-09 15:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: bug-gnu-emacs, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:


Hi Stefan --

Here is the problem; it's not that easy from the emacspeak side -- see
below.

Emacspeak uses the following algorithm to split text into chunks before
sending to the TTS engine.

1. Split by clauses -- where "clause" is determined by the buffer's
syntax table.

2. Next, split the clause into chunks based on property changes -- since
"changing voice params on any TTS engine triggres a clause boundary.
3. (2) is achieved by calling next-single-property-change

4. Result -- in EWW buffers, next-single-property-change always goes to
the newline  char when on text that isn't otherwise decorated
i.e. variable-pitch->nil for the 'face property.

For now I discovered the shr-use-fonts option and turned it off --- that
appears to fix my problem in large part. 

>> EWW appears to work differently -- if you take a plain paragraph that
>> spans multiple lines, the text uses "variable-pitch" as  the face
>> property -- except that that property is not set on the newline
>> characters within the paragraph.
>
> I'm not sure how hard/easy it may be to change SHR (used by EWW) to do
> that, but I have the impression that it may be non-trivial.
>
>> I'm sure this makes no visible difference to the layout -- but it
>> affects Emacspeak's logic for breaking content into meaningful
>> clauses.
>
> Maybe it would be simpler to change Emacspeak so it ignores face
> properties on whitespace?
>
>
>         Stefan
>
>

-- 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: EWW: Face property changes around newlines
  2019-01-09 15:01   ` T.V Raman
@ 2019-01-09 21:15     ` Stefan Monnier
  2019-01-09 21:19       ` T.V Raman
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2019-01-09 21:15 UTC (permalink / raw)
  To: T.V Raman; +Cc: bug-gnu-emacs, emacs-devel

> 2. Next, split the clause into chunks based on property changes -- since
> "changing voice params on any TTS engine triggres a clause boundary.
> 3. (2) is achieved by calling next-single-property-change

What I was thinking is that after calling next-single-property-change,
skip the subsequent whitespace and check to see if the property is back
to its previous value after the whitespace.


        Stefan



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: EWW: Face property changes around newlines
  2019-01-09 21:15     ` Stefan Monnier
@ 2019-01-09 21:19       ` T.V Raman
  2019-05-13 18:00         ` bug#34018: " Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: T.V Raman @ 2019-01-09 21:19 UTC (permalink / raw)
  To: monnier; +Cc: bug-gnu-emacs, emacs-devel, raman


Yes, that would work --- 
Stefan Monnier writes:
 > > 2. Next, split the clause into chunks based on property changes -- since
 > > "changing voice params on any TTS engine triggres a clause boundary.
 > > 3. (2) is achieved by calling next-single-property-change
 > 
 > What I was thinking is that after calling next-single-property-change,
 > skip the subsequent whitespace and check to see if the property is back
 > to its previous value after the whitespace.
 > 
 > 
 >         Stefan

-- 
Id: kg:/m/0285kf1 

-- 
Id: kg:/m/0285kf1 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bug#34018: EWW: Face property changes around newlines
  2019-01-09 21:19       ` T.V Raman
@ 2019-05-13 18:00         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-05-13 18:00 UTC (permalink / raw)
  To: T.V Raman; +Cc: 34018, monnier, emacs-devel

"T.V Raman" <raman@google.com> writes:

> Yes, that would work --- 

OK; seems like this doesn't require any changes in eww, then, so I'm
closing the bug report.

(The reason shr doesn't apply (some of the) face properties to the
newline character is that that things like underline would then extend
to the end of the line, which looks very ugly.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-05-13 18:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08 21:41 EWW: Face property changes around newlines T.V Raman
2019-01-09 14:35 ` Stefan Monnier
2019-01-09 15:01   ` T.V Raman
2019-01-09 21:15     ` Stefan Monnier
2019-01-09 21:19       ` T.V Raman
2019-05-13 18:00         ` bug#34018: " Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).