back-ericwa-experimental: merge changes from turnk

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/ericwa-experimental@34624 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2012-01-24 23:55:51 +00:00
parent 6417b8e6ae
commit 8c0cb9cb56
6 changed files with 190 additions and 8 deletions

View file

@ -1,9 +1,86 @@
2012-01-23 Eric Wasylishen <ewasylishen@gmail.com>
* Source/cairo/CairoFontInfo.m (-setupAttributes):
use CAIRO_HINT_METRICS_ON instead of CAIRO_HINT_METRICS_OFF,
otherwise some text is cut of (e.g. quit Ink with unsaved
changes, the "t" in "Quit" in the dialog is cut off)
2012-01-23 Eric Wasylishen <ewasylishen@gmail.com>
* Source/cairo/CairoFontInfo.m (-setupAttributes):
We must not leave the hinting settings as their defaults,
because if we did, that would mean using the surface defaults
which might or might not use hinting (xlib does by default.)
Since we make measurements outside of the context of a surface
(-advancementForGlyph:), we need to ensure that the same
hinting settings are used there as when we draw. For now,
just force hinting to be off.
2012-01-19 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/x11/XGServerWindow.m (-orderwindow:::): Introduce new
user defaults to respectively make app icons and mini windows
sticky (aka omnipresent).
2012-01-11 Fred Kiefer <FredKiefer@gmx.de>
* Source/winlib/WIN32FontEnumerator.m: Add missing include.
2012-01-11 Fred Kiefer <FredKiefer@gmx.de>
* Source/winlib/WIN32FontEnumerator.m,
* Source/cairo/CairoFontEnumerator.m,
* Source/xlib/GSXftFontInfo.m,
* Source/xlib/XGFont.m: Use NSDebugLLog instead of NSDebugLog to
reduce amount of default output.
2012-01-02 Eric Wasylishen <ewasylishen@gmail.com>
* Source/cairo/CairoGState.m (-GSShowGlyphsWithAdvances:):
Update the current point after drawing text. Should not affect
anything in gui right now, but will be useful later.
2011-12-24 Eric Wasylishen <ewasylishen@gmail.com>
* Source/cairo/CairoContext.m (-beginPrologueBBox:...):
Add a hack to get landscape printing working. Comment in the source
reproduced here:
FIXME: This is confusing... When an 8.5x11 page is set to
landscape, NSPrintInfo also swaps the paperSize to be 11x8.5,
but gui also adds a 90 degree rotation as if it will
be drawing on a 8.5x11 page. So, swap 11x8.5 back to 8.5x11 here.
2011-12-23 Eric Wasylishen <ewasylishen@gmail.com>
* Source/cairo/CairoContext.m (-beginPrologueBBox:...): Use
paper size from print info to set the cairo page size, instead
of using the bounding box (which is usually smaller than the
paper size, and was causing cairo print output to be wrong
compared to GNUstep's built-in PostScript writer.)
2011-11-28 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerEvent.m (initialize_keyboard): Don't use
XK_ISO_Level3_Shift as second alternate key.
* Documentation/Back/DefaultsSummary.gsdoc: Document this mapping.
2011-11-07 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGGLFormat.m (-assembleGLXAttributes:): Use
GLX_BUFFER_SIZE for NSOpenGLPFAColorSize instead of setting all
the single colour sizes, which was wrong.
2011-11-07 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerEvent.m (initialize_keyboard): Use
XK_ISO_Level3_Shift as second alternate key.
* Documentation/Back/DefaultsSummary.gsdoc: Document this mapping.
2011-11-04 Eric Wasylishen <ewasylishen@gmail.com>
* Source/x11/context.c: check for NULL from XRenderFindVisualFormat
2011-10-25 Eric Wasylishen <ewasylishen@gmail.com>
* Source/gsc/GSStreamContext.m:

View file

@ -27,6 +27,8 @@
#include <AppKit/NSBitmapImageRep.h>
#include <AppKit/NSGraphics.h>
#include <AppKit/NSPrintInfo.h>
#include <AppKit/NSPrintOperation.h>
#include "cairo/CairoContext.h"
#include "cairo/CairoGState.h"
@ -226,6 +228,32 @@
NSSize size;
NSString *contextType;
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
NSPrintInfo *printInfo = [printOp printInfo];
if (printInfo != nil)
{
size = [printInfo paperSize];
// FIXME: This is confusing..
// When an 8.5x11 page is set to landscape,
// NSPrintInfo also swaps the paperSize to be 11x8.5,
// but gui also adds a 90 degree rotation as if it will
// be drawing on a 8.5x11 page. So, swap 11x8.5 back to
// 8.5x11 here.
if ([printInfo orientation] == NSLandscapeOrientation)
{
size = NSMakeSize(size.height, size.width);
}
}
else
{
[NSException raise: NSInternalInconsistencyException
format: @"current print operation printInfo is nil in %@",
NSStringFromSelector(_cmd)];
return;
}
contextType = [context_info objectForKey:
NSGraphicsContextRepresentationFormatAttributeName];
@ -233,7 +261,6 @@
{
if ([contextType isEqual: NSGraphicsContextPSFormat])
{
size = boundingBox.size;
surface = [[CairoPSSurface alloc] initWithDevice: context_info];
[surface setSize: size];
// This strange setting is needed because of the way GUI handles offset.
@ -242,7 +269,6 @@
}
else if ([contextType isEqual: NSGraphicsContextPDFFormat])
{
size = boundingBox.size;
surface = [[CairoPDFSurface alloc] initWithDevice: context_info];
[surface setSize: size];
// This strange setting is needed because of the way GUI handles offset.

View file

@ -64,7 +64,7 @@ NSMutableDictionary * __allFonts;
face = [__allFonts objectForKey: name];
if (!face)
{
NSDebugLog(@"Font not found %@", name);
NSDebugLLog(@"NSFont", @"Font not found %@", name);
}
return face;
}
@ -184,13 +184,13 @@ static NSArray *faFromFc(FcPattern *pat)
familyArray = [fcxft_allFontFamilies objectForKey: familyString];
if (familyArray == nil)
{
NSDebugLog(@"Found font family %@", familyString);
NSDebugLLog(@"NSFont", @"Found font family %@", familyString);
familyArray = [[NSMutableArray alloc] init];
[fcxft_allFontFamilies setObject: familyArray
forKey: familyString];
RELEASE(familyArray);
}
NSDebugLog(@"fc enumerator: adding font: %@", name);
NSDebugLLog(@"NSFont", @"fc enumerator: adding font: %@", name);
[familyArray addObject: fontArray];
[fcxft_allFontNames addObject: name];
aFont = [[CairoFaceInfo alloc] initWithfamilyName: familyString

View file

@ -111,6 +111,17 @@
return NO;
}
// We must not leave the hinting settings as their defaults,
// because if we did, that would mean using the surface defaults
// which might or might not use hinting (xlib does by default.)
//
// Since we make measurements outside of the context of a surface
// (-advancementForGlyph:), we need to ensure that the same
// hinting settings are used there as when we draw. For now,
// just force hinting to be off.
cairo_font_options_set_hint_metrics(options, CAIRO_HINT_METRICS_ON);
cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
_scaled = cairo_scaled_font_create(face, &font_matrix, &ctm, options);
cairo_font_options_destroy(options);
if (cairo_scaled_font_status(_scaled) != CAIRO_STATUS_SUCCESS)
@ -394,6 +405,25 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
return;
}
// Set font options from the scaled font
// FIXME: Instead of setting the matrix, setting the face, and setting
// the options, we should be using cairo_set_scaled_font
{
cairo_font_options_t *options = cairo_font_options_create();
cairo_scaled_font_get_font_options(_scaled, options);
cairo_set_font_options(ct, options);
cairo_font_options_destroy(options);
}
if (cairo_status(ct) != CAIRO_STATUS_SUCCESS)
{
NSLog(@"Error while setting font options: %s",
cairo_status_to_string(cairo_status(ct)));
cairo_destroy(ct);
cairo_surface_destroy(isurface);
free(cdata);
return;
}
if ([path elementCount] > 0)
{
NSPoint p;
@ -482,6 +512,22 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
return;
}
// Set font options from the scaled font
// FIXME: Instead of setting the matrix, setting the face, and setting
// the options, we should be using cairo_set_scaled_font
{
cairo_font_options_t *options = cairo_font_options_create();
cairo_scaled_font_get_font_options(_scaled, options);
cairo_set_font_options(ct, options);
cairo_font_options_destroy(options);
}
if (cairo_status(ct) != CAIRO_STATUS_SUCCESS)
{
NSLog(@"Error while setting font options: %s",
cairo_status_to_string(cairo_status(ct)));
return;
}
cairo_show_text(ct, str);
if (cairo_status(ct) != CAIRO_STATUS_SUCCESS)
{

View file

@ -437,6 +437,7 @@ static inline float floatToUserSpace(NSAffineTransform *ctm, double d)
- (void) GSShowGlyphsWithAdvances: (const NSGlyph *)glyphs : (const NSSize *)advances : (size_t) length
{
// FIXME: this method should just be a call to cairo_show_glyphs
// FIXME: Currently advances is ignored
if (_ct)
{
@ -463,7 +464,16 @@ static inline float floatToUserSpace(NSAffineTransform *ctm, double d)
[(CairoFontInfo *)font drawGlyphs: glyphs
length: length
on: _ct];
double x, y;
cairo_get_current_point(_ct, &x, &y);
cairo_user_to_device(_ct, &x, &y);
cairo_restore(_ct);
// reset the current point
cairo_device_to_user(_ct, &x, &y);
[path moveToPoint: NSMakePoint(x,y)];
}
}

View file

@ -2034,9 +2034,10 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
(NSIconWindowMask|NSMiniWindowMask)) != 0))
{
/*
* Make any window which assumes the desktop level act as the background.
* Make any window which assumes the desktop level act as the
* background.
*/
if(window->win_attrs.window_level == NSDesktopWindowLevel)
if (window->win_attrs.window_level == NSDesktopWindowLevel)
{
[self _sendRoot: window->root
type: generic.netstates.net_wm_state_atom
@ -2048,13 +2049,35 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
}
else
{
BOOL sticky = NO;
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
[self _sendRoot: window->root
type: generic.netstates.net_wm_state_atom
window: window->ident
data0: _NET_WM_STATE_ADD
data1: generic.netstates.net_wm_state_skip_taskbar_atom
data2: generic.netstates.net_wm_state_skip_pager_atom
data3: 1];
data3: 1];
if ((window->win_attrs.window_style & NSIconWindowMask) != 0)
{
sticky = [defs boolForKey: @"GSStickyAppIcons"];
}
else if ((window->win_attrs.window_style & NSMiniWindowMask) != 0)
{
sticky = [defs boolForKey: @"GSStickyMiniWindows"];
}
if (sticky == YES)
{
[self _sendRoot: window->root
type: generic.netstates.net_wm_state_atom
window: window->ident
data0: _NET_WM_STATE_ADD
data1: generic.netstates.net_wm_state_sticky_atom
data2: 0
data3: 1];
}
}
}
}