Opened 6 years ago

Last modified 2 years ago

#14428 new bug

BPicture: Implement DrawString offsets variant

Reported by: jackburton Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Kits/Interface Kit Version: R1/Development
Keywords: Cc:
Blocked By: #5591 Blocking:
Platform: All

Description

When BView::DrawString(const char* string, int32 length, const BPoint* locations, int32 locationCount) was introduced, it wasn't implemented in BPicture.

It needs to be implemented, otherwise if an application uses that method to draw strings, those strings won't be printed.

Change History (10)

comment:1 by jackburton, 6 years ago

I think it can be implemented without adding a new BPicture op, by just handling each char as a single string. Of course it won't be very efficient.

comment:2 by waddlesplash, 6 years ago

Indeed not, and doing that also messes up font kerning with TTF subpixel hinting enabled. So that's not a good solution.

comment:3 by jackburton, 6 years ago

Right. Anyway, I see we already added new ops to the BPicture format, so I guess that adding some more won't hurt.

in reply to:  2 comment:4 by jackburton, 6 years ago

Replying to waddlesplash:

Indeed not, and doing that also messes up font kerning with TTF subpixel hinting enabled. So that's not a good solution.

I tried to implement it like I said in the previous comment, and actually it's not that bad. Moreover, since BPictures could be played not only by app_server, but also by other means (we use it for printing, for example), I think we could go with this implementation. At least for now.

Version 0, edited 6 years ago by jackburton (next)

comment:5 by jackburton, 6 years ago

Blocking: 5591 added

comment:6 by stippi, 6 years ago

hrev52716 adds a new op in BPicture. PicturePlayer contains a mechanism to handle clients that provide not all callbacks to BPicture::Play(). There the implementation in terms of the other DrawString() method should be added.

comment:7 by waddlesplash, 5 years ago

Blocked By: 5591 added
Blocking: 5591 removed

comment:9 by waddlesplash, 4 years ago

As stippi says above:

There the implementation in terms of the other DrawString() method should be added.

comment:10 by leavengood, 2 years ago

I found this interesting so I dug into it a bit to better explain.

If BPicture::Play has the DrawString(void* user, char* string, float deltax, float deltay) callback provided (callback 17), but NOT the new one added by Stephan for the multiple string drawing (callback 55), then the multiple string drawing should be implemented in terms of callback 17 to be backward compatible. Since the assumption is if the user provided a special string drawing routine they want strings drawn that way.

Though it may be a bit tricky because the DrawString callback just draws at the current location so SetPenLocation may be needed for each string as well, then restoring the existing pen location from before this operation.

With all this said this is very much a corner case as any older BPicture code would never have recorded a draw_string_locations call and the lack of the callback would not be an issue.

Note: See TracTickets for help on using tickets.