Closed
Bug 50998
Opened 25 years ago
Closed 23 years ago
XP impl of GetAveCharWidth and remove ifdef _win32 in GfxText
Categories
(Core :: Layout: Form Controls, defect, P2)
Core
Layout: Form Controls
Tracking
()
RESOLVED
FIXED
Future
People
(Reporter: rods, Assigned: john)
References
Details
(Whiteboard: [FIX])
Attachments
(6 files, 6 obsolete files)
1.89 KB,
patch
|
Biesinger
:
review+
|
Details | Diff | Splinter Review |
2.12 KB,
patch
|
sergei_d
:
review+
|
Details | Diff | Splinter Review |
686 bytes,
patch
|
Details | Diff | Splinter Review | |
1004 bytes,
patch
|
rbs
:
superreview+
|
Details | Diff | Splinter Review |
1.91 KB,
patch
|
Details | Diff | Splinter Review | |
2.08 KB,
patch
|
Details | Diff | Splinter Review |
I need to remove the ifdef _WIN32 in nsGfxTextControlFrame2.cpp and implement a
cross platform GetAveCharWidth
Reporter | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Priority: P3 → P2
Target Milestone: --- → Future
Reporter | ||
Comment 2•25 years ago
|
||
This really needs to be done for this release
Priority: P2 → P1
Target Milestone: Future → ---
Comment 3•25 years ago
|
||
Reporter | ||
Comment 4•25 years ago
|
||
I am all for that r=rods
looks ok to me. sr=buster. rod, are there other places that need this, or is
this sufficient?
Reporter | ||
Comment 6•25 years ago
|
||
Other than the OS/2 impl that is it, it is good to go.
Comment 7•25 years ago
|
||
Reporter | ||
Comment 8•25 years ago
|
||
Opps, good catch. r=rods
Comment 9•25 years ago
|
||
Reporter | ||
Updated•24 years ago
|
Target Milestone: --- → mozilla1.0.1
Reporter | ||
Updated•23 years ago
|
Target Milestone: mozilla1.0.1 → Future
Reporter | ||
Updated•23 years ago
|
Priority: P1 → P2
Assignee | ||
Comment 10•23 years ago
|
||
OK, so the way to fix this is to make GetAveCharWidth work on all our ports
using a cross-platform GetAveCharWidth. People can replace them with Real Ones
at a later date if the platform supports them (I'll put big comments in there
saying it's fake and that they should use a platform-specific one if available).
Taking.
Status: ASSIGNED → NEW
Assignee | ||
Updated•23 years ago
|
Status: NEW → ASSIGNED
Comment 12•23 years ago
|
||
jkeiser,
it's diffcult for us to implement all GetAve for beos/QT/mac/photon. i'd better
to add it on nsIFontMetrics first, then ask people who know the platform
implement it.
i know only qt, so i have implent the one for qt.
what do you think?
Comment 13•23 years ago
|
||
in all 10 toolkit:
implemented already: windows os/2 xlib gtk
not implemented yet: mac, photon, beos, QT
the patch is for QT. And we still need *****Mac, BeOS, Photon*******.
if you can do it, we need ur help. Thanks.
when we get patchs for all 3, we can get to change the nsIFontMetrics ...
Assignee | ||
Comment 14•23 years ago
|
||
Rick: for the rest of them, you can just do the same thing we do for GTK, namely
measure the character 'x'. I think that is a better XP implementation (and
faster) than the one in nsTextControlFrame anyway. And it will keep our
platforms relatively similar to each other. If there is a real AveCharWidth
call on the platform of course, it is better to use that.
Comment 15•23 years ago
|
||
using 'x'
Comment 16•23 years ago
|
||
there was a mAveCharWidth = mSpaceWidth already.
adding GetAveCharWidth only
Comment 17•23 years ago
|
||
using 'x'
Comment 18•23 years ago
|
||
removed the #if (_WIN32) || ...
Comment 19•23 years ago
|
||
terribly sorry that i can't find all the build env for these platforms to test
these patch .
add some masters of gfx.
HELP needed:
1. pls check the code and check whether better impl exists.
i am not familiar with most these platforms.
2. i dont have env to test them.
pls kindly test them if u do.
thanks!
Comment 20•23 years ago
|
||
These patches look alright to me, sr=rbs on all.
There is a remaining cleanup of #if defined(_WIN32) || defined(XP_OS2) in
mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp
While there, also saw a code that computes 'NSToCoordRound(p2t)' too many times
(caming from the patch in bug 99948):
// round to a multiple of p2t
nscoord rest = internalPadding%NSToCoordRound(p2t);
if( rest < NSToCoordRound(p2t) - rest) {
internalPadding = internalPadding - rest;
} else {
internalPadding = internalPadding + NSToCoordRound(p2t) - rest;
}
While you are there, mind cleaning up that code a little bit, e.g., use:
nscoord t = NSToCoordRound(p2t);
nscoord rest = internalPadding % t;
if( rest < t - rest) { // same as rest < half-of-pixel
internalPadding -= rest; // round down
} else {
internalPadding += t - rest; // round up
}
OS: Windows NT → All
Hardware: PC → All
Comment 21•23 years ago
|
||
thanks, rbs.
About nsGfxTextControlFrame.cpp:
Do u mean nsTextControlFrame.cpp?
The file is why i fix this bug. pls refer to #92980.
Tnanks for ur comments about NSToCoordRound. i will do it in #92980's patch.
Comment 22•23 years ago
|
||
> Do u mean nsTextControlFrame.cpp?
Yes. I typed one of the old names.
> The file is why i fix this bug. pls refer to #92980.
> Tnanks for ur comments about NSToCoordRound. i will do it in #92980's patch.
OK.
Assignee | ||
Comment 23•23 years ago
|
||
Comment on attachment 98566 [details] [diff] [review]
qt implementation
fm.widht won't compile--fm.width is better :)
Updated•23 years ago
|
Attachment #21561 -
Attachment is obsolete: true
Updated•23 years ago
|
Attachment #21571 -
Attachment is obsolete: true
Updated•23 years ago
|
Attachment #21628 -
Attachment is obsolete: true
Assignee | ||
Comment 24•23 years ago
|
||
This makes nsTextFrame use GetAveCharWidth() always instead of guessing that
the average width is 10 :) nsTextControlFrame will get its update when Rick
checks in his patch to that bug.
Comment 25•23 years ago
|
||
Comment on attachment 99462 [details] [diff] [review]
photon impl
hm... currently, mAveCharWidth of the photon port contains the width of a space
rather than an 'x' like the other ports. as that variable is currently unused,
I would change it to match the others.
Comment 26•23 years ago
|
||
Comment on attachment 98566 [details] [diff] [review]
qt implementation
+ PRUnichar averageX = (PRUnichar)'x';
use QChar here, because that's what fm.width takes.
Comment 27•23 years ago
|
||
Comment on attachment 99461 [details] [diff] [review]
Mac impl
r=biesi
Attachment #99461 -
Flags: review+
Comment 28•23 years ago
|
||
r=biesi on all patches if my comments are addressed (and the width typo gets fixed)
however, you might want to get r=sergei_d@fi.tartu.ee or
r=arougthopher@lizardland.net for the BeOS patch instead, as they are the ports
maintainers, afaik
Assignee | ||
Comment 29•23 years ago
|
||
rbs, could you sr the "Fix nsTextFrame" patch as well? It seems best to get it
checked in now or it will be one of those "yeah, we need to do that but we won't
until Gecko 3.0" things :)
Comment 30•23 years ago
|
||
Comment on attachment 99540 [details] [diff] [review]
Fix nsTextFrame
sr=rbs
Attachment #99540 -
Flags: superreview+
Comment 31•23 years ago
|
||
Comment on attachment 98566 [details] [diff] [review]
qt implementation
>Index: nsFontMetricsQT.h
>===================================================================
>RCS file: /cvsroot/mozilla/gfx/src/qt/nsFontMetricsQT.h,v
>retrieving revision 1.8
>diff -u -r1.8 nsFontMetricsQT.h
>--- nsFontMetricsQT.h 30 Oct 2001 22:57:49 -0000 1.8
>+++ nsFontMetricsQT.h 10 Sep 2002 09:17:04 -0000
>@@ -138,6 +138,7 @@
> NS_IMETHOD GetMaxAscent(nscoord &aAscent);
> NS_IMETHOD GetMaxDescent(nscoord &aDescent);
> NS_IMETHOD GetMaxAdvance(nscoord &aAdvance);
>+ NS_IMETHOD GetAveCharWidth(nscoord &aAveCharWidth);
> NS_IMETHOD GetFont(const nsFont *&aFont);
> NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
> NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
>@@ -201,6 +202,7 @@
> nscoord mMaxAscent;
> nscoord mMaxDescent;
> nscoord mMaxAdvance;
>+ nscoord mAveCharWidth;
> nscoord mXHeight;
> nscoord mSuperscriptOffset;
> nscoord mSubscriptOffset;
>Index: nsFontMetricsQT.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/gfx/src/qt/nsFontMetricsQT.cpp,v
>retrieving revision 1.25
>diff -u -r1.25 nsFontMetricsQT.cpp
>--- nsFontMetricsQT.cpp 7 Sep 2002 17:10:09 -0000 1.25
>+++ nsFontMetricsQT.cpp 10 Sep 2002 09:17:05 -0000
>@@ -644,6 +644,7 @@
> mMaxAscent = 0;
> mMaxDescent = 0;
> mMaxAdvance = 0;
>+ mAveCharWidth = 0;
> mXHeight = 0;
> mSuperscriptOffset = 0;
> mSubscriptOffset = 0;
>@@ -913,6 +914,9 @@
> mEmHeight = nscoord(fm.height() * f);
> mMaxAdvance = nscoord(fm.maxWidth() * f);
>
>+ PRUnichar averageX = (PRUnichar)'x';
>+ mAveCharWidth = nscoord(fm.width(averageX) * f);
>+
> mEmAscent = mMaxAscent;
> mEmDescent = mMaxDescent;
>
>@@ -1022,6 +1026,12 @@
> NS_IMETHODIMP nsFontMetricsQT::GetMaxAdvance(nscoord &aAdvance)
> {
> aAdvance = mMaxAdvance;
>+ return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsFontMetricsQT::GetAveCharWidth(nscoord &aAveCharWidth)
>+{
>+ aAveCharWidth = mAveCharWidth;
> return NS_OK;
> }
>
Comment 32•23 years ago
|
||
Attachment #98566 -
Attachment is obsolete: true
Comment 33•23 years ago
|
||
Attachment #99603 -
Attachment is obsolete: true
Comment 34•23 years ago
|
||
Updated•23 years ago
|
Attachment #99463 -
Flags: review+
Comment 35•23 years ago
|
||
Comment on attachment 99463 [details] [diff] [review]
beos impl
seems ok. Ohh, and i missed when AveCharWidth changed to "x" width instead of
Finnish developer name-based :)
Comment 36•23 years ago
|
||
ok, new patches look good to me. r=biesi on all non-obsolete patches here.
looks like you're ready to checkin.
Assignee | ||
Comment 37•23 years ago
|
||
I will check in. I don't think Rick has cvs access yet.
Whiteboard: [FIX]
Assignee | ||
Updated•23 years ago
|
Attachment #99462 -
Attachment is obsolete: true
Assignee | ||
Comment 38•23 years ago
|
||
Fix checked in. Let's see what this does to ports before resolving ;)
Assignee | ||
Comment 39•23 years ago
|
||
Well, that went alarmingly smoothly. Yippee, fix checked in to stay!
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•