View Issue Details

IDProjectCategoryView StatusLast Update
0002058ScribusInternalpublic2005-07-03 14:03
ReporterringercAssigned Toavox  
PrioritynormalSeverityfeatureReproducibilityalways
Status assignedResolutionopen 
Platformx86 LinuxOSFedora CoreOS Version3
Product Version1.3.0cvs 
Summary0002058: Text and font metrics
DescriptionWe need some internal APIs for doing things like determining the width of a string at a given font, finding out if some text will fit in a certain frame, etc.

Particularly important IMO are:


   double stringWidth(QString text, QString fontFace, int fontSizeDeciPt, float hScalePercent=1.0, float trackingAdj=0.0)

to return the width, in pt, of a string with the given text style. Another version to take a char style, once those are supported, would also be helpful.

   double totalFontHeight(QString fontFace, int fontSizeDeciPt)

to return the height in pt of a line of text in the specified font from highest rise to lowest drop.

   double maximumFontRise(QString fontFace, int fontSizeDeciPt)
   double maximumFontDrop(QString fontFace, int fontSizeDeciPt)

to return the maximum rise/drop above/below the baseline, respectively, of the font at the given size. This is useful for things like determining where the top of a text frame should be in order to exactly place the text its self. All these could probably be virtual members of Foi (without the font name), and/or members of ScFonts.

   double textHeight(QString text, PageItem* item, QString fontFace, int fontSizeDeciPt, float hScalePercent=1.0, float trackingAdj=0.0, float leading=-1)
   double textHeight(QString text, double width, QString fontFace, int fontSizeDeciPt, float hScalePercent=1.0, float trackingAdj=0.0, float leading=-1)

to return the total height of a block of text in a given PageItem or in a frame of a given width. Useful for automated layout decisions.

These could be useful for all sorts of things, though I'm mostly interested in them for scripting purposes. Riku had some other suggestions in 0001406 .
TagsNo tags attached.
Patch

Relationships

related to 0001405 acknowledged Support frame fit adjustment for text 
related to 0001648 closedfschmid Ability to get the line count in a text frame 
parent of 0001406 confirmed Add text metrics to scripter 
related to 0002708 closedcezaryece Autosizing of frames 
Not all the children of this issue are yet resolved or closed.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2005-06-06 09:20 ringerc New Issue
2005-06-06 09:20 ringerc Relationship added parent of 0001406
2005-06-06 09:20 ringerc Status new => acknowledged
2005-06-23 07:26 ringerc Relationship added related to 0001405
2005-06-23 07:26 ringerc Relationship added related to 0001648
2005-07-03 14:03 avox Status acknowledged => assigned
2005-07-03 14:03 avox Assigned To => avox
2005-10-11 16:33 ringerc Relationship added related to 0002708