View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001741 | Scribus | Scripter | public | 2005-03-02 08:55 | 2005-03-05 16:59 |
Reporter | TomK32 | Assigned To | subik | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.3.0cvs | ||||
Fixed in Version | 1.3.0cvs | ||||
Summary | 0001741: textoverflows() not working | ||||
Description | as it seems textoverflows is kinda buggy, below is my version which return the actual number of overflowing characters. char *name = const_cast<char*>(""); if (!PyArg_ParseTuple(args, "|es", "utf-8", &name)) return NULL; if(!checkHaveDocument()) return NULL; PageItem *item = GetUniqueItem(QString::fromUtf8(name)); if (item == NULL) return NULL; if (item->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't get info from a non-text frame", "python error")); return NULL; } QPixmap pgPix(1, 1); ScPainter *painter = new ScPainter(&pgPix, 1, 1); painter->translate(0.5, 0.5); item->DrawObj(painter, QRect(0, 0, 1, 1)); painter->end(); delete painter; int chars = item->itemText.count(); int maxchars = item->MaxChars; while (item->NextBox != 0) { item = item->NextBox; chars += item->itemText.count(); maxchars += item->MaxChars; } // no overrun if (maxchars > chars) return 0; // number of overrunning letters return PyInt_FromLong(static_cast<long>(chars - maxchars)); | ||||
Tags | No tags attached. | ||||
Patch | |||||
|
Thanks for that, Tom32k. I'll have to check that out (if subik doesn't beat me to it). It wouldn't hurt to submit changes as patches in 'diff -u' format, or as text files, rather than pasting them. Mantis sometimes does "interesting" things to text and formatting. |
|
it's now like this: <code>textOverflows</a>(["name", nolinks]) -> integer</code> Returns the actual number of overflowing characters in text frame "name". If is nolinks set to non zero value it takes only one frame - it doesn't use text frame linking. Without this parameter it search all linking chain. May raise WrongFrameTypeError if the target frame is not an text frame it needs testing. I'm too tired fro tonight as I cannot count the characters no more (seeing it twice ;)). I hope it will be closed tomorrow. |
|
it's working |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-03-02 08:55 | TomK32 | New Issue | |
2005-03-02 11:32 |
|
Note Added: 0003851 | |
2005-03-03 06:52 | subik | Status | new => assigned |
2005-03-03 06:52 | subik | Assigned To | => subik |
2005-03-03 19:50 | subik | Note Added: 0003865 | |
2005-03-04 15:37 | subik | Status | assigned => resolved |
2005-03-04 15:37 | subik | Fixed in Version | => 1.3.0cvs |
2005-03-04 15:37 | subik | Resolution | open => fixed |
2005-03-04 15:37 | subik | Note Added: 0003872 | |
2005-03-05 16:59 | cbradney | Status | resolved => closed |