mirror of
https://github.com/fltk/fltk.git
synced 2026-05-28 11:25:22 +08:00
STR #1098: fl_measure now round fractional sizes up instead of down, so that an area that is create with the values returned from fl_measure will be large enough to hold the same text generated with fl_draw.
Or in short: OS X Tooltips will not wrap... . git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4663 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+2
-1
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include "flstring.h"
|
#include "flstring.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#define MAXBUF 1024
|
#define MAXBUF 1024
|
||||||
|
|
||||||
@@ -309,7 +310,7 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) {
|
|||||||
|
|
||||||
for (p = str, lines=0; p;) {
|
for (p = str, lines=0; p;) {
|
||||||
e = expand(p, buf, w - symtotal, buflen, width, w != 0, draw_symbols);
|
e = expand(p, buf, w - symtotal, buflen, width, w != 0, draw_symbols);
|
||||||
if (int(width) > W) W = int(width);
|
if (int(ceil(width)) > W) W = int(ceil(width));
|
||||||
lines++;
|
lines++;
|
||||||
if (!*e || (*e == '@' && draw_symbols)) break;
|
if (!*e || (*e == '@' && draw_symbols)) break;
|
||||||
p = e;
|
p = e;
|
||||||
|
|||||||
Reference in New Issue
Block a user