Re: selections and combining characters

From: Andrew Dunbar (hippietrail@yahoo.com)
Date: Mon Apr 22 2002 - 22:59:18 EDT

  • Next message: Andrew Dunbar: "Re: undo and combining characters"

     --- Paul Rohr <paul@abisource.com> wrote: > For the
    sake of completeness, I should also ask:
    >
    > How should selections work for combining
    > characters?

    Now this really is tricky and we currently don't do
    a very good job at all. ):

    Ideally what looks like a character should be treated
    as a character. So when the user selects an "Á" which
    is made up of a base "A" plus a combining acute, we
    should select both and highlight both. This is why
    I think the piecetable needs to know about "glyphs
    made of multiple codepoints".

    Even more ideally, and I think MS does this, is to
    allow finer grain control with the keyboard. When
    doing shift-leftarrow and shift right-arrow we should
    be able to select just the accent. I'm not sure how
    this should work with ligatures though since
    highlight-
    ing half a ligature doesn't make much sense.

    In any case, the first part is what the normal user
    expects so I'd design around that and leave the
    second part till later since only advanced users would
    want it. It might be worth keeping in mind when we
    design though.

    > Again, one of the things that the Piece Table is
    > really good at is allowing
    > you to select all of the text "between" two
    > DocPositions, so that you can
    > format or delete that chunk of text.

    A more difficult problem is selecting bidi text where
    a logical sequence of characters in memory can require
    two (possible more?) discontinuous visible highlighted
    areas on-screen when the selection is partially
    English and partially Arabic, for example.
    So the DocPositions will be the same as now but on-
    screen we will need to draw multiple highlights.

    > I suspect that in some cases, it may be desirable
    > and/or reasonable to
    > select "part" of a combined glyph (for example,
    > ligatures) whereas in others
    > (the accented c-cedilla, for example), it isn't.

    This is tricky. There are several ways to do it.
    1) Always select "whole visible characters".
    2) Always select based on how the characters are
       represented internally: select c-cedilla as a
       single character when it's a single character,
       and allow individual selection of the c and the
       cedilla when a combining cedilla is used.
    3) Always allow either whole character selection
       regardless of internal representation and
    individual
       selection of the c and the cedilla regardless of
       internal representation.

    We currently do 2) but we should aim at 1) since it's
    the most logical to the user. 3) is an ideal but it
    would require the user to somehow choose between
    "select whole characters" and "select combining
    characters" which sounds like a UI nightmare.

    > Can anyone give a definitive enumeration of the
    > relevant screw cases here?
    > Remember that the main goal here is to come up with
    > a user experience that
    > Just Works for entering *lots* of text, not just for
    > twiddling a few
    > characters.

    That's why we should select based on visual glyphs.
    For this the piecetable needs to know about "base
    character+combining character" sequences and also
    about "ligatures".

    Note that we work okay with combining characters now
    if you have the fonts installed and the RemapGlyph
    hack turned off in your profile. We don't work well
    with ligatures since the highlight we draw for the
    selection makes wrong assumptions about the length in
    pixels of the selcted area. I thought there was a bug
    about this but I can't find it.

    We need to draw the highlighted and unhighlighted text
    as a complete unit for for the type shapers to have
    the correct context, then we draw the coloured
    highlight rectangle - or maybe the other way around.
    Currently we draw individual sections of the line, so
    if the selection starts or ends in the middle of an
    Arabic or Hindi string, the type shaper thinks this
    is the beginning or end of the string and gets the
    context wrong. This causes medial characters to be
    drawn in initial or final form and also breaks
    ligatures into two seperate characters.

    > bottom line
    > -----------
    > I suspect that this issue may be easier to nail down
    > than the undo case
    > previously mentioned:

    Nope it's much harder. Selection needs to know about
    the qualities of each character it encounters.

    >
    http://www.abisource.com/mailinglists/abiword-dev/02/Apr/0707.html
    >
    > If so, by all means tackle this one first.

    I think we need to do quite a bit of discussion and
    thinking and planning - the tackling can wait a bit (:

    Andrew Dunbar.

    > Paul
    > motto -- be sure to ask the right questions

    =====
    http://linguaphile.sourceforge.net http://www.abisource.com

    __________________________________________________
    Do You Yahoo!?
    Everything you'll ever need on one web page
    from News and Sport to Email and Music Charts
    http://uk.my.yahoo.com



    This archive was generated by hypermail 2.1.4 : Mon Apr 22 2002 - 23:01:02 EDT