Closed
Bug 96609
Opened 23 years ago
Closed 13 years ago
Tracker - add GetDimensions() in GFX
Categories
(Core Graveyard :: GFX, defect)
Core Graveyard
GFX
Tracking
(Not tracked)
RESOLVED
WONTFIX
Future
People
(Reporter: rbs, Assigned: dcone)
References
Details
Attachments
(2 files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review |
The fix for bug 20394 (and related) requires the support of the following methods in the nsIRenderingContext API. ============================================================================ NS_IMETHOD GetDimensions(const char* aString, PRUint32 aLength, nsDimensions& aDimensions) = 0; NS_IMETHOD GetDimensions(const PRUnichar* aString, PRUint32 aLength, nsDimensions& aDimensions, PRInt32* aFontID = nsnull) = 0; nsDimensions is the struct to fill. It is described below. Basically, since font-switching may arise when rendering a piece of (i18n) Unicode string, what is needed is to also return the max ascent and max descent of all the fonts involved. For a string in ASCII, there is no font-switching and thus: GetDimensions(const char* aString, ...) is: aDimensions.width = GetWidth(aString) with the current font aDimensions.ascent = the current font's ascent aDimensions.descent = the current font's descent For a string in Unicode, font-switching may arise and thus: GetDimensions(const PRUnichar* aString, ...) is: while (font-switching) { aDimensions.width += GetWidth(substring) with the current font aDimensions.ascent = max{aDimensions.ascent, current font's ascent} aDimensions.descent = max{aDimensions.descent, current font's descent} } This is basically what is needed, but it has to be in the dialect expected by each platform :-( Together with these, two trivial methods DrawString2(ASCII/Unicode) are also needed. Unlike DrawString(), these new methods will draw a string without tampering with the aY parameter supplied by the caller. They are aimed at allowing to draw muliple piece of string from different fonts in separate calls, yet while still keeping them baseline-aligned. The DrawString2() are obtained from DrawString() in a trivial manner and it is anticipated that they will replace DrawString() once the switch to GetDimensions() is over and callers fixed. An example of a patch to hook GetDimensions() is attached to bug 95721: http://bugzilla.mozilla.org/showattachment.cgi?attach_id=46317 This bug is currently blocking my font changes that could potentially solve: - bug 30910 - Pref for minimum font size - bug 32536 - text gets wrong font size - bug 61883 - Smarter default prefs for the 5 basic CSS fonts - bug 74186 - Unable to choose different size for serif and sans-serif fonts - bug 96535 - Font sizes too large for Japanese UI (and perhaps other bugs as well, and despite the intensive testing, introduce a few regressions of its own, in all fairness -- there is no denying the software life cycle :-) ============================================================================ /* Struct used to represent the overall extent of a string whose rendering may involve switching between different fonts that have different metrics. */ struct nsDimensions { // max ascent amongst all the fonts needed to represent the string nscoord ascent; // max descent amongst all the fonts needed to represent the string nscoord descent; // width of the string nscoord width; nsDimensions() { Clear(); } /* Set all member data to zero */ void Clear() { ascent = descent = width = 0; } /* Append another dimension */ void operator += (const nsDimensions& aOther) { if (ascent < aOther.ascent) ascent = aOther.ascent; if (descent < aOther.descent) descent = aOther.descent; width += aOther.width; } };
Updated•23 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.6
The above patches (together with those recently checked in for OS/2 and BeoS) should bring the ports back in the loop, or at least provide enough head start to plaform gurus to fix typos. I haven't touched Motif because it seems to be there only for historical reasons. I mostly saw empty stubs checked in there since 1999.
Updated•23 years ago
|
Target Milestone: mozilla0.9.6 → mozilla1.0
With the recent fix for GfxMac in bug 100868, the three main platforms are now in parity. Only postscript printing (GfxPS) remains missing.
Comment 6•23 years ago
|
||
Re-assigning to dcone
Assignee: kmcclusk → dcone
Status: ASSIGNED → NEW
Target Milestone: mozilla1.0 → mozilla1.1
Updated•16 years ago
|
Product: Core → Core Graveyard
Comment 9•13 years ago
|
||
The need for this internal change has long since been obviated by other internal changes.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•