Author: fredkiefer
Date: Mon Dec 8 11:09:42 2014
New Revision: 38238
URL: http://svn.gna.org/viewcvs/gnustep?rev=38238&view=rev
Log:
* Source/NSLayoutManager.m
(_insertionPointRectForCharacterIndex:textContainer:): Fix
initial
cursor insertion location with paragraph alignment setting.
This patch has no visual effect as the alignment of the typing
attributes never gets set.
Based on patch by Marcian Lytwyn <[email protected]>.
* Source/NSLayoutManager.m: Fix some compiler warnings.
Modified:
libs/gui/trunk/ChangeLog
libs/gui/trunk/Source/NSLayoutManager.m
Modified: libs/gui/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/ChangeLog?rev=38238&r1=38237&r2=38238&view=diff
==============================================================================
--- libs/gui/trunk/ChangeLog (original)
+++ libs/gui/trunk/ChangeLog Mon Dec 8 11:09:42 2014
@@ -1,3 +1,13 @@
+2014-12-08 Fred Kiefer <[email protected]>
+
+ * Source/NSLayoutManager.m
+ (_insertionPointRectForCharacterIndex:textContainer:): Fix initial
+ cursor insertion location with paragraph alignment setting.
+ This patch has no visual effect as the alignment of the typing
+ attributes never gets set.
+ Based on patch by Marcian Lytwyn <[email protected]>.
+ * Source/NSLayoutManager.m: Fix some compiler warnings.
+
2014-12-07 Fred Kiefer <[email protected]>
* Headers/Additions/GNUstepGUI/GSXibLoading.h,
Modified: libs/gui/trunk/Source/NSLayoutManager.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSLayoutManager.m?rev=38238&r1=38237&r2=38238&view=diff
==============================================================================
--- libs/gui/trunk/Source/NSLayoutManager.m (original)
+++ libs/gui/trunk/Source/NSLayoutManager.m Mon Dec 8 11:09:42 2014
@@ -883,15 +883,28 @@
glyph_index = [self numberOfGlyphs] - 1;
if (glyph_index == (unsigned int)-1)
{ /* No information is available. Get default font height. */
- NSFont *f = [_typingAttributes objectForKey:NSFontAttributeName];
+ NSFont *f = [_typingAttributes objectForKey: NSFontAttributeName];
/* will be -1 if there are no text containers */
*textContainer = num_textcontainers - 1;
r = NSMakeRect(0, 0, 1, [f boundingRectForFont].size.height);
if (num_textcontainers > 0)
{
+ NSParagraphStyle *paragraph = [_typingAttributes objectForKey:
NSParagraphStyleAttributeName];
+ NSTextAlignment alignment = [paragraph alignment];
+
tc = textcontainers + num_textcontainers - 1;
r.origin.x += [tc->textContainer lineFragmentPadding];
+
+ // Apply left/right/center justification...
+ if (alignment == NSRightTextAlignment)
+ {
+ r.origin.x += [tc->textContainer containerSize].width;
+ }
+ else if (alignment == NSCenterTextAlignment)
+ {
+ r.origin.x += [tc->textContainer containerSize].width / 2;
+ }
}
return r;
}
@@ -1376,7 +1389,8 @@
int i, j;
NSRect *rects;
NSUInteger count;
- NSColor *color, *last_color;
+ NSColor *color = nil;
+ NSColor *last_color = nil;
NSGraphicsContext *ctxt = GSCurrentContext();
@@ -1406,9 +1420,8 @@
glyph_run = run_for_glyph_index(range.location, glyphs, &glyph_pos,
&char_pos);
i = range.location - glyph_pos;
- last_color = nil;
first_char_pos = char_pos;
- while ((glyph_run != nil) && (i + glyph_pos < range.location + range.length))
+ while ((glyph_run != NULL) && (i + glyph_pos < range.location +
range.length))
{
NSRange r = NSMakeRange(glyph_pos + i, glyph_run->head.glyph_length - i);
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs