mirror of https://github.com/python/cpython
Today's Carbon Toolbox addition: QDTextBounds()
This commit is contained in:
parent
e843e482ce
commit
ca3b2ffbb9
|
@ -293,6 +293,24 @@ static PyObject *Fm_GetAppFont(PyObject *_self, PyObject *_args)
|
||||||
return _res;
|
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[] = {
|
static PyMethodDef Fm_methods[] = {
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if !TARGET_API_MAC_CARBON
|
||||||
|
@ -337,6 +355,8 @@ static PyMethodDef Fm_methods[] = {
|
||||||
"() -> (short _rv)"},
|
"() -> (short _rv)"},
|
||||||
{"GetAppFont", (PyCFunction)Fm_GetAppFont, 1,
|
{"GetAppFont", (PyCFunction)Fm_GetAppFont, 1,
|
||||||
"() -> (short _rv)"},
|
"() -> (short _rv)"},
|
||||||
|
{"QDTextBounds", (PyCFunction)Fm_QDTextBounds, 1,
|
||||||
|
"(Buffer inText) -> (Rect bounds)"},
|
||||||
{NULL, NULL, 0}
|
{NULL, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class MyScanner(Scanner):
|
||||||
return [
|
return [
|
||||||
"FMInput_ptr", # Not needed for now
|
"FMInput_ptr", # Not needed for now
|
||||||
"FMOutPtr", # Ditto
|
"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
|
"FontInfo", # Ditto
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -62,6 +62,8 @@ class MyScanner(Scanner):
|
||||||
return [
|
return [
|
||||||
([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
|
([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
|
||||||
([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
|
([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
|
||||||
|
([('short', 'byteCount', 'InMode'), ('void_ptr', 'textAddr', 'InMode'),],
|
||||||
|
[('TextBuffer', 'inText', 'InMode')]),
|
||||||
]
|
]
|
||||||
|
|
||||||
def writeinitialdefs(self):
|
def writeinitialdefs(self):
|
||||||
|
|
|
@ -18,6 +18,13 @@ from macsupport import *
|
||||||
|
|
||||||
# Create the type objects
|
# Create the type objects
|
||||||
|
|
||||||
|
class RevVarInputBufferType(VarInputBufferType):
|
||||||
|
def passInput(self, name):
|
||||||
|
return "%s__len__, %s__in__" % (name, name)
|
||||||
|
|
||||||
|
TextBuffer = RevVarInputBufferType()
|
||||||
|
|
||||||
|
|
||||||
includestuff = includestuff + """
|
includestuff = includestuff + """
|
||||||
#ifdef WITHOUT_FRAMEWORKS
|
#ifdef WITHOUT_FRAMEWORKS
|
||||||
#include <Fonts.h>
|
#include <Fonts.h>
|
||||||
|
|
Loading…
Reference in New Issue