mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Adjust 'really large' sizes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17186 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
de241312ea
commit
7d44f67c49
3 changed files with 19 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
2003-07-10 03:37 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/NSStringDrawing.m, Source/NSTextView.m: Adjust "really large"
|
||||
sizes to ensure accuracy to a whole point.
|
||||
|
||||
2003-07-10 Benhur Stein <benhur@inf.ufsm.br>
|
||||
|
||||
* Source/NSSavePanel.m: added new private method
|
||||
|
|
|
@ -49,6 +49,14 @@ This might be a common case if lots of calls to -size... and -draw...
|
|||
are paired.
|
||||
*/
|
||||
|
||||
|
||||
#define LARGE_SIZE 8e6
|
||||
/*
|
||||
8e6 is not as arbitrary as it seems. 8e6 is chosen because it's close to
|
||||
1<<23-1, the largest number that can be stored in a 32-bit float with an
|
||||
ulp of 0.5, which means things should round to the correct whole point.
|
||||
*/
|
||||
|
||||
static NSTextStorage *textStorage;
|
||||
static NSLayoutManager *layoutManager;
|
||||
static NSTextContainer *textContainer;
|
||||
|
@ -92,7 +100,7 @@ glyphs to be drawn upside-down, so we need to tell NSFont to flip the fonts.
|
|||
[textStorage replaceCharactersInRange: NSMakeRange(0, [textStorage length])
|
||||
withString: @""];
|
||||
|
||||
[textContainer setContainerSize: NSMakeSize(1e8, 1e8)];
|
||||
[textContainer setContainerSize: NSMakeSize(LARGE_SIZE, LARGE_SIZE)];
|
||||
|
||||
if (ctm->matrix.m11 != 1.0 || ctm->matrix.m12 != 0.0 ||
|
||||
ctm->matrix.m21 != 0.0 || fabs(ctm->matrix.m22) != 1.0)
|
||||
|
@ -153,11 +161,11 @@ glyphs to be drawn upside-down, so we need to tell NSFont to flip the fonts.
|
|||
withString: @""];
|
||||
|
||||
/*
|
||||
TODO: Use rect.size.heigth instead of 1e8? Should make things faster,
|
||||
TODO: Use rect.size.heigth instead of LARGE_SIZE? Should make things faster,
|
||||
since we'll only typeset what fits, but lines that used to fit partially
|
||||
won't fit at all.
|
||||
*/
|
||||
[textContainer setContainerSize: NSMakeSize(rect.size.width, 1e8)];
|
||||
[textContainer setContainerSize: NSMakeSize(rect.size.width, LARGE_SIZE)];
|
||||
|
||||
if (ctm->matrix.m11 != 1.0 || ctm->matrix.m12 != 0.0 ||
|
||||
ctm->matrix.m21 != 0.0 || fabs(ctm->matrix.m22) != 1.0)
|
||||
|
@ -234,7 +242,7 @@ glyphs to be drawn upside-down, so we need to tell NSFont to flip the fonts.
|
|||
[textStorage replaceCharactersInRange: NSMakeRange(0, [textStorage length])
|
||||
withString: @""];
|
||||
|
||||
[textContainer setContainerSize: NSMakeSize(1e8, 1e8)];
|
||||
[textContainer setContainerSize: NSMakeSize(LARGE_SIZE, LARGE_SIZE)];
|
||||
[layoutManager setUsesScreenFonts: YES];
|
||||
|
||||
[textStorage replaceCharactersInRange: NSMakeRange(0, 0)
|
||||
|
|
|
@ -137,7 +137,8 @@ static BOOL noLayoutManagerException(void)
|
|||
/* The shared notification center */
|
||||
static NSNotificationCenter *notificationCenter;
|
||||
|
||||
/* Default max. size. */
|
||||
/* Default max. size. Don't change this without understanding and checking
|
||||
for roundoff issues. Whole points should be representable. */
|
||||
#define HUGE 1e7
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue