diff options
author | Just van Rossum <just@letterror.com> | 2002-01-07 14:15:02 (GMT) |
---|---|---|
committer | Just van Rossum <just@letterror.com> | 2002-01-07 14:15:02 (GMT) |
commit | ca3b2ffbb90d107476397689243da9d4d8b47286 (patch) | |
tree | 8ce3a853619c4f1f2f5251055868e6614aa06494 | |
parent | e843e482cea527ebcb74d33d1b49623c756fee18 (diff) | |
download | cpython-ca3b2ffbb90d107476397689243da9d4d8b47286.zip cpython-ca3b2ffbb90d107476397689243da9d4d8b47286.tar.gz cpython-ca3b2ffbb90d107476397689243da9d4d8b47286.tar.bz2 |
Today's Carbon Toolbox addition: QDTextBounds()
-rw-r--r-- | Mac/Modules/fm/_Fmmodule.c | 20 | ||||
-rw-r--r-- | Mac/Modules/fm/fmscan.py | 4 | ||||
-rw-r--r-- | Mac/Modules/fm/fmsupport.py | 7 |
3 files changed, 30 insertions, 1 deletions
diff --git a/Mac/Modules/fm/_Fmmodule.c b/Mac/Modules/fm/_Fmmodule.c index c5ab18a..009f34d 100644 --- a/Mac/Modules/fm/_Fmmodule.c +++ b/Mac/Modules/fm/_Fmmodule.c @@ -293,6 +293,24 @@ static PyObject *Fm_GetAppFont(PyObject *_self, PyObject *_args) return _res; } +static PyObject *Fm_QDTextBounds(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + char *inText__in__; + int inText__len__; + int inText__in_len__; + Rect bounds; + if (!PyArg_ParseTuple(_args, "s#", + &inText__in__, &inText__in_len__)) + return NULL; + inText__len__ = inText__in_len__; + QDTextBounds(inText__len__, inText__in__, + &bounds); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &bounds); + return _res; +} + static PyMethodDef Fm_methods[] = { #if !TARGET_API_MAC_CARBON @@ -337,6 +355,8 @@ static PyMethodDef Fm_methods[] = { "() -> (short _rv)"}, {"GetAppFont", (PyCFunction)Fm_GetAppFont, 1, "() -> (short _rv)"}, + {"QDTextBounds", (PyCFunction)Fm_QDTextBounds, 1, + "(Buffer inText) -> (Rect bounds)"}, {NULL, NULL, 0} }; diff --git a/Mac/Modules/fm/fmscan.py b/Mac/Modules/fm/fmscan.py index 6ade547..7b2b142 100644 --- a/Mac/Modules/fm/fmscan.py +++ b/Mac/Modules/fm/fmscan.py @@ -54,7 +54,7 @@ class MyScanner(Scanner): return [ "FMInput_ptr", # Not needed for now "FMOutPtr", # Ditto - "void_ptr", # Don't know how to do this right now +## "void_ptr", # Don't know how to do this right now "FontInfo", # Ditto ] @@ -62,6 +62,8 @@ class MyScanner(Scanner): return [ ([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]), ([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]), + ([('short', 'byteCount', 'InMode'), ('void_ptr', 'textAddr', 'InMode'),], + [('TextBuffer', 'inText', 'InMode')]), ] def writeinitialdefs(self): diff --git a/Mac/Modules/fm/fmsupport.py b/Mac/Modules/fm/fmsupport.py index 3b40716..10d3fce 100644 --- a/Mac/Modules/fm/fmsupport.py +++ b/Mac/Modules/fm/fmsupport.py @@ -18,6 +18,13 @@ from macsupport import * # Create the type objects +class RevVarInputBufferType(VarInputBufferType): + def passInput(self, name): + return "%s__len__, %s__in__" % (name, name) + +TextBuffer = RevVarInputBufferType() + + includestuff = includestuff + """ #ifdef WITHOUT_FRAMEWORKS #include <Fonts.h> |