[haiku-bugs] Re: [Haiku] #6761: Wrong positioning printing line of words in different colors

  • From: "pulkomandy" <trac@xxxxxxxxxxxx>
  • Date: Fri, 04 Nov 2016 13:18:39 -0000

#6761: Wrong positioning printing line of words in different colors
----------------------------------+-----------------------
   Reporter:  laplace             |      Owner:  korli
       Type:  bug                 |     Status:  new
   Priority:  normal              |  Milestone:  R1
  Component:  Servers/app_server  |    Version:  R1/alpha2
 Resolution:                      |   Keywords:
 Blocked By:                      |   Blocking:
Has a Patch:  0                   |   Platform:  All
----------------------------------+-----------------------

Comment (by pulkomandy):

 This fixes it:

 {{{
 diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp
 index fb7a55f..73f6277 100644
 --- a/src/kits/interface/View.cpp
 +++ b/src/kits/interface/View.cpp
 @@ -3175,6 +3175,14 @@ BView::DrawString(const char* string, int32 length,
 BPoint location,

         _FlushIfNotInTransaction();

 +       if (fCurrentPicture != NULL)
 +       {
 +               // The app server does not know how to update the pen
 location when
 +               // drawing to a picture, so do it ourselves.
 +               // FIXME handle the escapement deltas
 +               MovePenBy(StringWidth(string, length), 0);
 +       }
 +
         // this modifies our pen location, so we invalidate the flag.
         fState->valid_flags &= ~B_VIEW_PEN_LOCATION_BIT;
  }
 }}}

 Is there a way to do this on app_server side, as is the case for direct
 drawing? Is there a way to handle the escapement deltas if done there?

--
Ticket URL: <https://dev.haiku-os.org/ticket/6761#comment:7>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: