Age | Commit message (Collapse) | Author |
|
|
|
2004/04/23 15:07:44 pl 1.163.38.5: corrected incomplete call of X11SalFrame::Init
2004/03/29 06:54:37 mi 1.163.38.4: RESYNC: (1.168-1.172); FILE MERGED
2004/02/03 11:51:27 mi 1.163.38.3: RESYNC: (1.163.76.1-1.168); FILE MERGED
2003/12/11 07:47:11 mi 1.163.38.2: RESYNC: (1.163-1.163.76.1); FILE MERGED
2003/12/10 14:09:21 mi 1.163.38.1: #i19974# OOoBean / SetPluginParent() can set null parent now
|
|
2004/03/18 11:23:22 pl 1.16.100.1: #112891# merge from apoc02
|
|
*
* $RCSfile$
*
* $Revision$
*
* last change: $Author$ $Date$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef XLFD_ATTRIBUTE_HXX
#include "xlfd_attr.hxx"
#endif
#ifndef XLFD_SIMPLE_HXX
#include "xlfd_smpl.hxx"
#endif
// --------------------------------------------------------------------------
//
//
// broken down structure equivalent to a Xlfd string
//
//
// --------------------------------------------------------------------------
Xlfd::Xlfd()
{
}
// XlfdCompare abi has to be qsort(3) compatible, the sorting result must
// guarantee that fonts with SameFontoutline() are successive
// XlfdCompare relies on vFrom->mpFactory eq vTo->mpFactory. Since comparing
// Xlfd's is done by comparing attributes there is no way around this.
extern "C" int
XlfdCompare( const void *vFrom, const void *vTo )
{
const Xlfd *pFrom = (Xlfd*)vFrom;
const Xlfd *pTo = (Xlfd*)vTo;
// Compare outline description
if ( pFrom->mnFoundry != pTo->mnFoundry )
return (int)pFrom->mnFoundry - (int)pTo->mnFoundry;
if ( pFrom->mnFamily != pTo->mnFamily )
return (int)pFrom->mnFamily - (int)pTo->mnFamily;
if ( pFrom->mnWeight != pTo->mnWeight )
return (int)pFrom->mnWeight - (int)pTo->mnWeight;
if ( pFrom->mnSlant != pTo->mnSlant )
return (int)pFrom->mnSlant - (int)pTo->mnSlant;
if ( pFrom->mnSetwidth != pTo->mnSetwidth )
return (int)pFrom->mnSetwidth - (int)pTo->mnSetwidth;
// Addstyle name is futile tricky. it may contain encoding information
// (like "ansi_1251") which Compares equal, or it may contain style
// information (like "serif") which Compares unequal, anyway if the font
// is "interface user" or "interface system" then compare equal anyway to
// build fontsets as large as possible
if ( pFrom->mnAddstyle == pTo->mnAddstyle )
return 0;
AttributeProvider *pFactory = pFrom->mpFactory;
Attribute *pFamily = pFactory->RetrieveFamily( pFrom->mnFamily );
if ( pFamily->HasFeature(XLFD_FEATURE_APPLICATION_FONT) )
return 0;
Attribute *pFromAddStyle = pFactory->RetrieveAddstyle( pFrom->mnAddstyle );
Attribute *pToAddStyle = pFactory->RetrieveAddstyle( pTo->mnAddstyle );
// if both addstyles denote encodings or if one denotes an
// encoding and the other denotes a style which really
// duplicates weight and slant information
int nFromCompare = (pFromAddStyle->GetValue() != RTL_TEXTENCODING_DONTKNOW)
|| (pFromAddStyle->HasFeature(XLFD_FEATURE_REDUNDANTSTYLE)) ?
-1 : pFrom->mnAddstyle;
int nToCompare = (pToAddStyle->GetValue() != RTL_TEXTENCODING_DONTKNOW)
|| (pToAddStyle->HasFeature(XLFD_FEATURE_REDUNDANTSTYLE)) ?
-1 : pTo->mnAddstyle;
return nFromCompare - nToCompare;
}
// check whether two fonts are identical as appearance is concerned
// this does not Compare the actual scaling of two fonts
Bool
Xlfd::SameFontoutline( const Xlfd* pComparedTo ) const
{
void* pThis = (void*)this;
return XlfdCompare( (void*)pThis, (void*)pComparedTo ) == 0 ;
}
unsigned short
Xlfd::GetEncoding() const
{
Attribute *pAddstyle = mpFactory->RetrieveAddstyle( mnAddstyle );
if ( pAddstyle->GetValue() != RTL_TEXTENCODING_DONTKNOW )
return pAddstyle->GetValue();
Attribute *pEncoding = mpFactory->RetrieveCharset( mnCharset );
return pEncoding->GetValue();
}
XlfdFonttype
Xlfd::Fonttype() const
{
if ( (mnAverageWidth == 0) && (mnPixelSize == 0) && (mnPointSize == 0) )
{
return (mnResolutionX == 0)
&& (mnResolutionY == 0) ? eTypeScalable : eTypeScalableBitmap;
}
return eTypeBitmap;
}
void
Advance( const char** pFrom, const char** pTo )
{
const char *pTmp = *pTo;
for( ; (*pTmp != '\0') && (*pTmp++ != '-'); )
{}
*pFrom = *pTo;
*pTo = pTmp;
}
Bool
Xlfd::IsConformant (const char* pXlfd) const
{
// X FontNameRegistry prefix "-"
if (*pXlfd++ != '-')
return False;
// All Xlfd FontName fields are defined
int nNumFields = 1;
while (*pXlfd != '\0')
{
if (*pXlfd++ == '-')
nNumFields++;
}
// enough entries ?
if (nNumFields != 14)
return False;
// and the last one is not empty as well ?
if (*(pXlfd - 1) == '-')
return False;
return True;
}
// this is the real workhorse function. Since this is called for every font
// in the fontpath it has to be as fast a possible
Bool
Xlfd::FromString( const char* pXlfdstring, AttributeProvider *pFactory )
{
if (!IsConformant(pXlfdstring))
return False;
const char* pFrom = pXlfdstring + 1;
const char* pTo = pFrom;
mpFactory = pFactory;
Advance( &pFrom, &pTo ); //-foundry-*
mnFoundry = mpFactory->InsertFoundry( pFrom, pTo - pFrom - 1 );
Advance( &pFrom, &pTo ); // -*-family-*
mnFamily = mpFactory->InsertFamily( pFrom, pTo - pFrom - 1 );
Advance( &pFrom, &pTo ); // -*-*-weight-*
mnWeight = mpFactory->InsertWeight( pFrom, pTo - pFrom - 1 );
Advance( &pFrom, &pTo ); //-*-*-*-slant-*
mnSlant = mpFactory->InsertSlant( pFrom, pTo - pFrom - 1 );
Advance( &pFrom, &pTo ); //-*-*-*-*-setwidth-*
mnSetwidth = mpFactory->InsertSetwidth( pFrom, pTo - pFrom - 1 );
Advance( &pFrom, &pTo ); //-*-*-*-*-*-Addstyle-*
mnAddstyle = mpFactory->InsertAddstyle( pFrom, pTo - pFrom - 1 );
Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-height-*
mnPixelSize = atoi( pFrom );
Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-pt height-*
mnPointSize = atoi( pFrom );
Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-x resolution-*
mnResolutionX = atoi( pFrom );
Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-y resolution-*
mnResolutionY = atoi( pFrom );
Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-spacing-*
mcSpacing = pFrom == pTo ? '\0' : *pFrom;
Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-*-average-*
mnAverageWidth = atoi( pFrom );
Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-*-*-registry-encoding
const char* pTmp = pFrom;
Advance( &pTmp, &pTo );
mnCharset = mpFactory->InsertCharset( pFrom, pTo - pFrom );
// sanity check whether we have really found a valid XLFD, if not
// throw away the whole font, since we have no idea what parts of
// the XLFD contains the error.
if ( !(pTo > pFrom) )
return False;
// a non-empty family name is essential, since otherwise the font
// would match the "default font" #52299#
Attribute* pFamily = mpFactory->RetrieveFamily( mnFamily );
const char* pFamilyName = pFamily->GetName();
if ( pFamilyName[0] == '\0' )
return False;
// well done
return True;
}
#if OSL_DEBUG_LEVEL > 1
// pure debug for now: this is only to inspect/pretty print a Xlfd struct
const char*
Xlfd::ToString( ByteString &rString ) const
{
AppendAttribute( mpFactory->RetrieveFoundry(mnFoundry), rString );
AppendAttribute( mpFactory->RetrieveFamily(mnFamily), rString );
AppendAttribute( mpFactory->RetrieveWeight(mnWeight), rString );
AppendAttribute( mpFactory->RetrieveSlant(mnSlant), rString );
AppendAttribute( mpFactory->RetrieveSetwidth(mnSetwidth), rString );
AppendAttribute( mpFactory->RetrieveAddstyle(mnAddstyle), rString );
rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnPixelSize ) );
rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnPointSize ) );
rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnResolutionX ) );
rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnResolutionY ) );
rString.Append("-"); rString.Append( (char)mcSpacing );
rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnAverageWidth ) );
AppendAttribute( mpFactory->RetrieveCharset(mnCharset), rString );
return rString.GetBuffer() ;
}
void
Xlfd::Dump() const
{
ByteString aString;
fprintf(stderr, "Xlfd: %s\n", ToString(aString) );
}
#endif
|
|
2004/03/23 10:37:38 pl 1.171.30.2: RESYNC: (1.171-1.172); FILE MERGED
2004/03/18 11:23:23 pl 1.171.30.1: #112891# merge from apoc02
|
|
2004/04/02 11:19:22 pl 1.117.2.1: #i23684# add kerning for type1 fonts
|
|
2004/04/01 17:26:01 pl 1.2.32.1: #i23684# kerning for printer
|
|
2004/03/18 11:23:21 pl 1.28.58.1: #112891# merge from apoc02
|
|
2004/03/18 11:23:21 pl 1.28.84.1: #112891# merge from apoc02
|
|
2004/03/18 11:23:21 pl 1.5.224.1: #112891# merge from apoc02
|
|
2004/03/18 11:23:20 pl 1.7.32.1: #112891# merge from apoc02
|
|
2004/03/18 11:23:20 pl 1.36.32.1: #112891# merge from apoc02
|
|
2004/03/18 11:23:20 pl 1.10.122.1: #112891# merge from apoc02
|
|
|
|
|
|
2004/05/04 14:20:54 pl 1.3.2.5: #i25153# search for gnome-panel to identify gnome
2004/04/26 11:47:43 pl 1.3.2.4: #i28370# fallback to generic plugin if suitable desktop plugin does not exist
2004/03/10 20:49:42 pl 1.3.2.3: merge from vcl20: yield mutex acquisition
2004/03/02 15:10:14 pl 1.3.2.2: enable gnome autodetect
2004/02/27 10:56:17 pl 1.3.2.1: activate gtk plugin for CWS
|
|
2004/03/01 13:34:31 pl 1.9.34.1: first step in SalDisplay cleanup
|
|
2004/04/02 13:01:59 ssa 1.171.2.3: RESYNC: (1.171-1.172); FILE MERGED
2004/03/02 11:47:07 pl 1.171.2.2: correct condition in X11SalFrame::Init
2004/03/01 13:34:11 pl 1.171.2.1: first step in SalDisplay cleanup
|
|
2004/02/27 08:31:37 ssa 1.4.66.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/03/01 13:34:10 pl 1.7.2.1: first step in SalDisplay cleanup
|
|
2004/03/01 13:34:10 pl 1.32.2.1: first step in SalDisplay cleanup
|
|
2004/04/02 13:02:35 ssa 1.9.66.2: RESYNC: (1.9-1.10); FILE MERGED
2004/03/01 13:34:09 pl 1.9.66.1: first step in SalDisplay cleanup
|
|
2004/03/09 17:12:57 pl 1.23.2.1: handle graphics exposes after all XCopyArea calls
|
|
2004/03/11 15:58:24 ssa 1.30.2.2: #i25130# track window visibilty to avoid garbage in pixmap cache, track clipping region to allow for direct window painting, move NWPaint methods to GtkSalGraphics
2004/03/01 13:34:09 pl 1.30.2.1: first step in SalDisplay cleanup
|
|
2004/03/09 17:12:57 pl 1.11.2.2: handle graphics exposes after all XCopyArea calls
2004/03/01 13:34:08 pl 1.11.2.1: first step in SalDisplay cleanup
|
|
2004/02/27 08:31:36 ssa 1.12.2.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/03/01 13:34:07 pl 1.20.2.1: first step in SalDisplay cleanup
|
|
2004/03/01 13:34:06 pl 1.16.82.1: first step in SalDisplay cleanup
|
|
2004/03/25 10:59:22 mmeeks 1.7.66.1: Fix a number of nasty bugs, bring the glib/gtk+ and VCL mainloops to parity
so inferior loops work correctly, fix a number of nasty threading / race bugs.
Reviewed by: pl
|
|
2004/03/10 20:49:43 pl 1.20.2.3: merge from vcl20: yield mutex acquisition
2004/03/01 13:34:05 pl 1.20.2.2: first step in SalDisplay cleanup
2004/02/27 08:31:35 ssa 1.20.2.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/04/02 13:03:44 ssa 1.52.2.3: RESYNC: (1.52-1.53); FILE MERGED
2004/03/25 10:59:22 mmeeks 1.52.2.2: Fix a number of nasty bugs, bring the glib/gtk+ and VCL mainloops to parity
so inferior loops work correctly, fix a number of nasty threading / race bugs.
Reviewed by: pl
2004/03/01 13:33:26 pl 1.52.2.1: #i25477# get rid of internal events for frame being destroyed
|
|
2004/03/25 10:59:21 mmeeks 1.33.2.3: Fix a number of nasty bugs, bring the glib/gtk+ and VCL mainloops to parity
so inferior loops work correctly, fix a number of nasty threading / race bugs.
Reviewed by: pl
2004/03/01 13:34:04 pl 1.33.2.2: first step in SalDisplay cleanup
2004/02/27 08:31:34 ssa 1.33.2.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/02/27 08:31:34 ssa 1.12.66.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/03/01 13:34:02 pl 1.24.66.1: first step in SalDisplay cleanup
|
|
2004/03/01 13:34:01 pl 1.28.66.1: first step in SalDisplay cleanup
|
|
2004/03/25 10:59:21 mmeeks 1.2.2.1: Fix a number of nasty bugs, bring the glib/gtk+ and VCL mainloops to parity
so inferior loops work correctly, fix a number of nasty threading / race bugs.
Reviewed by: pl
|
|
2004/03/11 15:58:24 ssa 1.1.2.3: #i25130# track window visibilty to avoid garbage in pixmap cache, track clipping region to allow for direct window painting, move NWPaint methods to GtkSalGraphics
2004/03/04 18:09:15 ssa 1.1.2.2: #i25130# support for theme change
2004/02/27 08:31:33 ssa 1.1.2.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/04/26 14:09:53 pl 1.2.2.5: #116502# move for child frames did not work correctly
2004/03/15 17:08:26 pl 1.2.2.4: improve initial frame size
2004/03/10 16:41:08 pl 1.2.2.3: add: visibility notify
2004/03/04 15:44:26 pl 1.2.2.2: #115278# make plugged mode work
2004/02/27 15:46:29 pl 1.2.2.1: #i25181# send simple ExtText input as keyinput/release
|
|
2004/03/25 10:59:21 mmeeks 1.2.2.3: Fix a number of nasty bugs, bring the glib/gtk+ and VCL mainloops to parity
so inferior loops work correctly, fix a number of nasty threading / race bugs.
Reviewed by: pl
2004/03/01 13:34:00 pl 1.2.2.2: first step in SalDisplay cleanup
2004/02/27 08:31:32 ssa 1.2.2.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/03/11 15:58:23 ssa 1.26.2.3: #i25130# track window visibilty to avoid garbage in pixmap cache, track clipping region to allow for direct window painting, move NWPaint methods to GtkSalGraphics
2004/03/09 17:12:56 pl 1.26.2.2: handle graphics exposes after all XCopyArea calls
2004/02/27 08:31:32 ssa 1.26.2.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/03/01 13:33:59 pl 1.36.2.1: first step in SalDisplay cleanup
|
|
2004/03/25 10:59:20 mmeeks 1.22.2.2: Fix a number of nasty bugs, bring the glib/gtk+ and VCL mainloops to parity
so inferior loops work correctly, fix a number of nasty threading / race bugs.
Reviewed by: pl
2004/03/01 13:33:58 pl 1.22.2.1: first step in SalDisplay cleanup
|
|
2004/03/01 13:33:58 pl 1.8.2.2: first step in SalDisplay cleanup
2004/02/27 08:31:31 ssa 1.8.2.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/04/02 13:03:58 ssa 1.2.2.2: RESYNC: (1.2-1.3); FILE MERGED
2004/03/16 16:31:21 pl 1.2.2.1: #i26570# honor ENABLE_GTK flag
|
|
2004/03/01 13:33:56 pl 1.2.2.1: first step in SalDisplay cleanup
|
|
2004/04/26 14:09:53 pl 1.3.2.15: #116502# move for child frames did not work correctly
2004/03/15 17:08:26 pl 1.3.2.14: improve initial frame size
2004/03/12 14:44:02 ssa 1.3.2.13: STYLE_DEFAULT means maximize
2004/03/11 15:58:23 ssa 1.3.2.12: #i25130# track window visibilty to avoid garbage in pixmap cache, track clipping region to allow for direct window painting, move NWPaint methods to GtkSalGraphics
2004/03/10 16:44:27 pl 1.3.2.11: missing initializer
2004/03/10 16:41:09 pl 1.3.2.10: add: visibility notify
2004/03/09 16:00:19 pl 1.3.2.9: combine motion events for speed
2004/03/08 18:21:15 pl 1.3.2.8: avoid dispatching initial style set signal
2004/03/04 18:09:14 ssa 1.3.2.7: #i25130# support for theme change
2004/03/04 15:44:25 pl 1.3.2.6: #115278# make plugged mode work
2004/03/03 12:19:21 pl 1.3.2.5: #i25165# evaluate window state correctly in GetWindowState
2004/03/01 13:33:55 pl 1.3.2.4: first step in SalDisplay cleanup
2004/02/27 15:46:29 pl 1.3.2.3: #i25181# send simple ExtText input as keyinput/release
2004/02/27 13:02:06 pl 1.3.2.2: #i25161# balance IMCommit/KeyUp
2004/02/27 08:31:30 ssa 1.3.2.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/03/31 18:59:22 fa 1.1.2.11: - Fix disabled PushButtons (ie Tools->Configure...) and SpinField edit boxes
and button. (we weren't enabling the widgets at all)
- Fix scrollbar Thumb sizes to account for the difference between OOo's size
for controls and the GTK theme's size
2004/03/31 17:40:32 fa 1.1.2.10: Remove some older WIDGETSET_GTK stuff, convert some GdkWindows -> GdkDrawables
2004/03/22 21:42:58 fa 1.1.2.9: Dont attempt to case a GdkPixmap directly to a GdkWindow, but use both
objects' superclass instead, GdkDrawable.
2004/03/11 15:58:22 ssa 1.1.2.8: #i25130# track window visibilty to avoid garbage in pixmap cache, track clipping region to allow for direct window painting, move NWPaint methods to GtkSalGraphics
2004/03/09 17:12:56 pl 1.1.2.7: handle graphics exposes after all XCopyArea calls
2004/03/09 16:52:56 ssa 1.1.2.6: #i25130# improve pixmap caching
2004/03/08 17:51:04 ssa 1.1.2.5: #i25130# remove dbg output
2004/03/05 10:29:22 ssa 1.1.2.4: #i25130# please solaris compiler
2004/03/04 18:07:59 ssa 1.1.2.3: #i25130# provide pixmap caches to speed up drawing
2004/03/01 13:33:54 pl 1.1.2.2: first step in SalDisplay cleanup
2004/02/27 08:31:30 ssa 1.1.2.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/03/16 16:31:20 pl 1.1.2.2: #i26570# honor ENABLE_GTK flag
2004/02/27 08:31:29 ssa 1.1.2.1: #i25130# initial native widget framework, merged from srx645
|
|
2004/04/02 13:04:13 ssa 1.2.2.2: RESYNC: (1.2-1.3); FILE MERGED
2004/03/16 16:31:20 pl 1.2.2.1: #i26570# honor ENABLE_GTK flag
|
|
2004/03/25 10:59:20 mmeeks 1.3.2.2: Fix a number of nasty bugs, bring the glib/gtk+ and VCL mainloops to parity
so inferior loops work correctly, fix a number of nasty threading / race bugs.
Reviewed by: pl
2004/02/27 08:31:28 ssa 1.3.2.1: #i25130# initial native widget framework, merged from srx645
|