summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXFont.c
diff options
context:
space:
mode:
authordas <das@noemail.net>2007-06-29 03:22:00 (GMT)
committerdas <das@noemail.net>2007-06-29 03:22:00 (GMT)
commit394293e8ec190211a5d90b20f4e3f799a50945ae (patch)
treec06cbd1a38889e6a8b8630f5eceab1c1b9d60f13 /macosx/tkMacOSXFont.c
parent0ec736baa4e50ba3f5884d1e46ac0502acc962be (diff)
downloadtk-394293e8ec190211a5d90b20f4e3f799a50945ae.zip
tk-394293e8ec190211a5d90b20f4e3f799a50945ae.tar.gz
tk-394293e8ec190211a5d90b20f4e3f799a50945ae.tar.bz2
* macosx/tkMacOSXScrlbr.c: correct int <-> dobule conversion issues
that could lead to Carbon getting confused about scrollbar thumb size. * macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage) use TkMacOSX{Setup,Restore}DrawingContext() to setup/restore clip & colors. (TkMacOSXSetupDrawingContext, TkMacOSXRestoreDrawingContext): add save and restore of QD port clip region; factor out clip region code common to CG and QD branches; check for port and context validity; handle tkPictureIsOpen flag during QD port setup. (TkScrollWindow): remove unnecessary scroll region manipulation * macosx/tkMacOSXDraw.c: remove second global QD temp region * macosx/tkMacOSXInt.h: (no longer necessary) and rename * macosx/tkMacOSXRegion.c: remaining global QD temp region. * macosx/tkMacOSXSubwindows.c: * macosx/tkMacOSXWindowEvent.c: * macosx/tkMacOSXDraw.c: make useCGDrawing variable MODULE_SCOPE * macosx/tkMacOSXFont.c: and sync formatting with HEAD. * macosx/tkMacOSXButton.c: reduce reliance on current QD port * macosx/tkMacOSXColor.c: setting and remove unnecessary * macosx/tkMacOSXDebug.c: references to a drawable's QD port, * macosx/tkMacOSXDebug.h: notably replace GetWindowFromPort( * macosx/tkMacOSXDialog.c: TkMacOSXGetDrawablePort()) idiom by new * macosx/tkMacOSXDraw.c: TkMacOSXDrawableWindow() and change * macosx/tkMacOSXKeyEvent.c: TkMacOSXSetColorInPort() to take a port * macosx/tkMacOSXMenu.c: argument. * macosx/tkMacOSXMenubutton.c: * macosx/tkMacOSXMouseEvent.c: * macosx/tkMacOSXScale.c: * macosx/tkMacOSXScrlbr.c: * macosx/tkMacOSXSubwindows.c: * macosx/tkMacOSXWindowEvent.c: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXInt.h: factor out macros, declarations * macosx/tkMacOSXPrivate.h (new): and prototypes that are purely internal and private to the 'macosx' sources into a new internal header file that does _not_ get installed into Tk.framework/PrivateHeaders. * macosx/tkMacOSXButton.c: #include new tkMacOSXPrivate.h * macosx/tkMacOSXCarbonEvents.c: instead of tkMacOSXInt.h. * macosx/tkMacOSXClipboard.c: * macosx/tkMacOSXColor.c: * macosx/tkMacOSXCursor.c: * macosx/tkMacOSXDebug.c: * macosx/tkMacOSXDialog.c: * macosx/tkMacOSXDraw.c: * macosx/tkMacOSXEntry.c: * macosx/tkMacOSXEvent.c: * macosx/tkMacOSXFont.c: * macosx/tkMacOSXHLEvents.c: * macosx/tkMacOSXInit.c: * macosx/tkMacOSXKeyEvent.c: * macosx/tkMacOSXMenu.c: * macosx/tkMacOSXMenubutton.c: * macosx/tkMacOSXMenus.c: * macosx/tkMacOSXMouseEvent.c: * macosx/tkMacOSXNotify.c: * macosx/tkMacOSXRegion.c: * macosx/tkMacOSXScale.c: * macosx/tkMacOSXScrlbr.c: * macosx/tkMacOSXSubwindows.c: * macosx/tkMacOSXWindowEvent.c: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXXStubs.c: FossilOrigin-Name: 98571053aff75093d3f2522e005412f507b86c23
Diffstat (limited to 'macosx/tkMacOSXFont.c')
-rw-r--r--macosx/tkMacOSXFont.c94
1 files changed, 45 insertions, 49 deletions
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 2cd3dda..94c2ade 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -12,10 +12,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXFont.c,v 1.3.2.9 2007/04/29 02:26:49 das Exp $
+ * RCS: @(#) $Id: tkMacOSXFont.c,v 1.3.2.10 2007/06/29 03:22:02 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkMacOSXFont.h"
#include "tclInt.h" /* for Tcl_CreateNamespace() */
@@ -257,7 +257,7 @@ static int GetFamilyOrAliasNum(const char *faceName, short *familyPtr);
static Tcl_Encoding GetFontEncoding(int faceNum, int allowSymbol, int *isSymbolPtr);
static Tk_Uid GetUtfFaceName(StringPtr faceNameStr);
static OSStatus GetThemeFontAndFamily(const ThemeFontID themeFontId,
- FMFontFamily* fontFamily, unsigned char *fontName, SInt16 *fontSize,
+ FMFontFamily *fontFamily, unsigned char *fontName, SInt16 *fontSize,
Style *fontStyle);
@@ -266,7 +266,7 @@ static OSStatus GetThemeFontAndFamily(const ThemeFontID themeFontId,
*
* TkpFontPkgInit --
*
- * This procedure is called when an application is created. It
+ * This procedure is called when an application is created. It
* initializes all the structures that are used by the
* platform-dependant code on a per application basis.
*
@@ -414,6 +414,7 @@ GetThemeFontAndFamily(
TkMacOSXDbgMsg("FMGetFontFamilyFromName failed.");
}
}
+
return err;
}
@@ -425,13 +426,13 @@ GetThemeFontAndFamily(
* Map a platform-specific native font name to a TkFont.
*
* Results:
- * The return value is a pointer to a TkFont that represents the
+ * The return value is a pointer to a TkFont that represents the
* native font. If a native font by the given name could not be
* found, the return value is NULL.
*
- * Every call to this procedure returns a new TkFont structure,
- * even if the name has already been seen before. The caller should
- * call TkpDeleteFont() when the font is no longer needed.
+ * Every call to this procedure returns a new TkFont structure, even
+ * if the name has already been seen before. The caller should call
+ * TkpDeleteFont() when the font is no longer needed.
*
* The caller is responsible for initializing the memory associated
* with the generic TkFont when this function returns and releasing
@@ -480,19 +481,19 @@ TkpGetNativeFont(
*
* TkpGetFontFromAttributes --
*
- * Given a desired set of attributes for a font, find a font with
- * the closest matching attributes.
+ * Given a desired set of attributes for a font, find a font with the
+ * closest matching attributes.
*
* Results:
- * The return value is a pointer to a TkFont that represents the
- * font with the desired attributes. If a font with the desired
- * attributes could not be constructed, some other font will be
- * substituted automatically.
+ * The return value is a pointer to a TkFont that represents the font
+ * with the desired attributes. If a font with the desired attributes
+ * could not be constructed, some other font will be substituted
+ * automatically.
*
- * Every call to this procedure returns a new TkFont structure,
- * even if the specified attributes have already been seen before.
- * The caller should call TkpDeleteFont() to free the platform-
- * specific data when the font is no longer needed.
+ * Every call to this procedure returns a new TkFont structure, even
+ * if the specified attributes have already been seen before. The
+ * caller should call TkpDeleteFont() to free the platform- specific
+ * data when the font is no longer needed.
*
* The caller is responsible for initializing the memory associated
* with the generic TkFont when this function returns and releasing
@@ -503,13 +504,14 @@ TkpGetNativeFont(
*
*---------------------------------------------------------------------------
*/
+
TkFont *
TkpGetFontFromAttributes(
- TkFont *tkFontPtr, /* If non-NULL, store the information in
- * this existing TkFont structure, rather than
+ TkFont *tkFontPtr, /* If non-NULL, store the information in this
+ * existing TkFont structure, rather than
* allocating a new structure to hold the
* font; the existing contents of the font
- * will be released. If NULL, a new TkFont
+ * will be released. If NULL, a new TkFont
* structure is allocated. */
Tk_Window tkwin, /* For display where font will be used. */
CONST TkFontAttributes *faPtr)
@@ -580,15 +582,15 @@ found:
* TkpDeleteFont --
*
* Called to release a font allocated by TkpGetNativeFont() or
- * TkpGetFontFromAttributes(). The caller should have already
- * released the fields of the TkFont that are used exclusively by
- * the generic TkFont code.
+ * TkpGetFontFromAttributes(). The caller should have already
+ * released the fields of the TkFont that are used exclusively by the
+ * generic TkFont code.
*
* Results:
- * None.
+ * TkFont is deallocated.
*
* Side effects:
- * TkFont is deallocated.
+ * None.
*
*---------------------------------------------------------------------------
*/
@@ -597,10 +599,7 @@ void
TkpDeleteFont(
TkFont *tkFontPtr) /* Token of font to be deleted. */
{
- MacFont *fontPtr;
-
- fontPtr = (MacFont *) tkFontPtr;
- ReleaseFont(fontPtr);
+ ReleaseFont((MacFont *) tkFontPtr);
}
/*
@@ -608,8 +607,8 @@ TkpDeleteFont(
*
* TkpGetFontFamilies --
*
- * Return information about the font families that are available
- * on the display of the given window.
+ * Return information about the font families that are available on
+ * the display of the given window.
*
* Results:
* Modifies interp's result object to hold a list of all the available
@@ -645,8 +644,8 @@ TkpGetFontFamilies(
* screen fonts that make up a font object.
*
* Results:
- * Modifies interp's result object to hold a list containing the
- * names of the screen fonts that make up the given font object.
+ * Modifies interp's result object to hold a list containing the names
+ * of the screen fonts that make up the given font object.
*
* Side effects:
* None.
@@ -687,7 +686,7 @@ TkpGetSubFonts(
*
* Results:
* The return value is the number of bytes from source that
- * fit into the span that extends from 0 to maxLength. *lengthPtr is
+ * fit into the span that extends from 0 to maxLength. *lengthPtr is
* filled with the x-coordinate of the right edge of the last
* character that did fit.
*
@@ -1009,18 +1008,18 @@ Tk_DrawChars(
Display *display, /* Display on which to draw. */
Drawable drawable, /* Window or pixmap in which to draw. */
GC gc, /* Graphics context for drawing characters. */
- Tk_Font tkfont, /* Font in which characters will be drawn;
- * must be the same as font used in GC. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
- * '\0' terminated. All Tk meta-characters
+ Tk_Font tkfont, /* Font in which characters will be drawn; must
+ * be the same as font used in GC. */
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
- * is passed to this function. If they are
- * not stripped out, they will be displayed as
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
* regular printing characters. */
- int numBytes, /* Number of bytes in string. */
- int x, int y) /* Coordinates at which to place origin of
- * string when drawing. */
+ int numBytes, /* Number of bytes in string. */
+ int x, int y) /* Coordinates at which to place origin of the
+ * string when drawing. */
{
MacDrawable *macWin = (MacDrawable *) drawable;
MacFont *fontPtr = (MacFont *) tkfont;
@@ -2158,11 +2157,8 @@ TkMacOSXInitControlFontStyle(
MacFont *fontPtr = (MacFont *) tkfont;
FontFamily *lastFamilyPtr = fontPtr->subFontArray[0].familyPtr;
- fsPtr->flags =
- kControlUseFontMask|
- kControlUseSizeMask|
- kControlUseFaceMask|
- kControlUseJustMask;
+ fsPtr->flags = kControlUseFontMask | kControlUseSizeMask |
+ kControlUseFaceMask | kControlUseJustMask;
fsPtr->font = lastFamilyPtr->faceNum;
fsPtr->size = fontPtr->size;
fsPtr->style = fontPtr->style;