DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2941
Version: 1.3-feature


@Ian, can't blame you -- impressed you took on fl_text_extents()
at all.. big job, multiple platforms!

But isn't the multiline issue simpler? Perhaps I'm missing
something, but I would think the hard work has been done already..
The case of multiple lines, a three line example might be:

    First line
    Middle line
    Last line

Forgetting alignment for now, and assuming first and last lines
aren't blank (can be determined with fl_text_extent() to see if
there's no inking area) and we want the dx/dy/w/h extents of
this multiline string, wouldn't the overall 'h' of all three lines
be the sum of FH+MH+LH, where:

    FH = fl_height()-dy of "First line"
    MH = fl_height()
    LH = dy of "Last line"

e.g:

                                        _____________________
                                        _____ dy          |
 ######     #    #####    ####    #####   |               |
 #          #    #    #  #          #     |               |
 #####      #    #    #   ####      #     | FH            | fl_height()
 #          #    #####        #     #     |               |
 #          #    #   #   #    #     #     |               |
 #          #    #    #   ####      #     |               |
. <-- baseline                          __|_______________|__
                                          |               |
 #    #  #  ####   ####   #     ####      |               |
 ##  ##  #  #   #  #   #  #     #         |               |
 # ## #  #  #   #  #   #  #     ###       | MH            | fl_height())
 #    #  #  #   #  #   #  #     #         |               |
 #    #  #  #   #  #   #  #     #         |               |
 #    #  #  ####   ####   ####  ####      |               |
. <-- baseline                            |_______________|__
                                          |               |
 #         ##     ####    #####           |               |
 #        #  #   #          #             | LH            |
 #       #    #   ####      #             | (dy of last)  | fl_height()
 #       ######       #     #             |               |
 #       #    #  #    #     #             |               |
 ######  #    #   ####      #           __|___            |
. <-- baseline                          __________________|__


And this would of course extend to any number of middle lines.

The trick would be to watch out for leading and trailing blank lines,
but these could be detected by the existing fl_text_extent() on each
line to detect the first and last inked lines, and adjust dy and h.

What I figure gets tricky is the mixture of the FL_ALIGN_* flags
which affect horiz + vertical orientation (INSIDE, OUTSIDE)
as well as the origin of each line (CENTER).

Tabs might be another issue, not sure.
But I guess all this nothing the multiline fl_draw() doesn't
already do to calculate text alignment, and you've already done
the hard work to calculate font inking sizes.


Link: http://www.fltk.org/str.php?L2941
Version: 1.3-feature

_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to