mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 23:31:02 +00:00
Automatically turn off screen fonts if required according to the current context's ctm.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17067 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c246aaf25c
commit
c8ac5f25e4
2 changed files with 32 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
2003-06-29 17:37 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/NSStringDrawing.m (-drawAtPoint:, -drawAtRect:, -size):
|
||||
Automatically turn off screen fonts in the layout manager if the
|
||||
ctm for the current context isn't the identity matrix (possibly
|
||||
flipped vertically).
|
||||
|
||||
2003-06-28 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Tools/make_services.m: Alter format of filter info.
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "AppKit/NSAffineTransform.h"
|
||||
#include "AppKit/NSLayoutManager.h"
|
||||
#include "AppKit/NSTextContainer.h"
|
||||
#include "AppKit/NSTextStorage.h"
|
||||
|
@ -83,6 +85,7 @@ glyphs to be drawn upside-down, so we need to tell NSFont to flip the fonts.
|
|||
{
|
||||
NSRange r;
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSAffineTransform *ctm = GSCurrentCTM(ctxt);
|
||||
|
||||
init_string_drawing();
|
||||
|
||||
|
@ -91,6 +94,16 @@ glyphs to be drawn upside-down, so we need to tell NSFont to flip the fonts.
|
|||
|
||||
[textContainer setContainerSize: NSMakeSize(1e8, 1e8)];
|
||||
|
||||
if (ctm->matrix.m11 != 1.0 || ctm->matrix.m12 != 0.0 ||
|
||||
ctm->matrix.m21 != 0.0 || fabs(ctm->matrix.m22) != 1.0)
|
||||
{
|
||||
[layoutManager setUsesScreenFonts: NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
[layoutManager setUsesScreenFonts: YES];
|
||||
}
|
||||
|
||||
[textStorage replaceCharactersInRange: NSMakeRange(0, 0)
|
||||
withAttributedString: self];
|
||||
|
||||
|
@ -132,6 +145,7 @@ glyphs to be drawn upside-down, so we need to tell NSFont to flip the fonts.
|
|||
BOOL need_clip;
|
||||
NSRect used;
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSAffineTransform *ctm = GSCurrentCTM(ctxt);
|
||||
|
||||
init_string_drawing();
|
||||
|
||||
|
@ -145,6 +159,16 @@ glyphs to be drawn upside-down, so we need to tell NSFont to flip the fonts.
|
|||
*/
|
||||
[textContainer setContainerSize: NSMakeSize(rect.size.width, 1e8)];
|
||||
|
||||
if (ctm->matrix.m11 != 1.0 || ctm->matrix.m12 != 0.0 ||
|
||||
ctm->matrix.m21 != 0.0 || fabs(ctm->matrix.m22) != 1.0)
|
||||
{
|
||||
[layoutManager setUsesScreenFonts: NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
[layoutManager setUsesScreenFonts: YES];
|
||||
}
|
||||
|
||||
[textStorage replaceCharactersInRange: NSMakeRange(0, 0)
|
||||
withAttributedString: self];
|
||||
|
||||
|
@ -211,6 +235,7 @@ glyphs to be drawn upside-down, so we need to tell NSFont to flip the fonts.
|
|||
withString: @""];
|
||||
|
||||
[textContainer setContainerSize: NSMakeSize(1e8, 1e8)];
|
||||
[layoutManager setUsesScreenFonts: YES];
|
||||
|
||||
[textStorage replaceCharactersInRange: NSMakeRange(0, 0)
|
||||
withAttributedString: self];
|
||||
|
|
Loading…
Reference in a new issue