Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 145770 Details for
Bug 211660
Pango Composer, Bad Number Rendering and Positioning
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
work-in-progress patch
firefox-1.5-pango-rendering-dimension.patch (text/plain), 8.18 KB, created by
Akira TAGOH
on 2007-01-17 03:26:44 UTC
(
hide
)
Description:
work-in-progress patch
Filename:
MIME Type:
Creator:
Akira TAGOH
Created:
2007-01-17 03:26:44 UTC
Size:
8.18 KB
patch
obsolete
>diff -pruN -x '.moz*' -x 'firefox*' -x dist -x build -x 'config*' -x .libs -x .deps -x '*a' -x '*so' -x '*o' -x '*html' mozilla.orig/gfx/src/gtk/nsFontMetricsPango.cpp mozilla/gfx/src/gtk/nsFontMetricsPango.cpp >--- mozilla.orig/gfx/src/gtk/nsFontMetricsPango.cpp 2007-01-11 18:00:04.000000000 +0900 >+++ mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 2007-01-17 12:01:30.000000000 +0900 >@@ -1214,6 +1214,12 @@ nsFontMetricsPango::GetRangeWidth(const > > pango_layout_line_get_x_ranges(line, aStart, aEnd, &ranges, &n_ranges); > >+ if (ranges == NULL) { >+ /* this usually shouldn't be happened. it just appears if give >+ * the invalid range to pango_layout_line_get_x_ranges() >+ */ >+ return NS_ERROR_FAILURE; >+ } > aWidth = (ranges[((n_ranges - 1) * 2) + 1] - ranges[0]); > > f = mDeviceContext-> DevUnitsToAppUnits(); >diff -pruN -x '.moz*' -x 'firefox*' -x dist -x build -x 'config*' -x .libs -x .deps -x '*a' -x '*so' -x '*o' -x '*html' mozilla.orig/gfx/src/ps/nsFontMetricsPango.cpp mozilla/gfx/src/ps/nsFontMetricsPango.cpp >--- mozilla.orig/gfx/src/ps/nsFontMetricsPango.cpp 2007-01-11 18:00:04.000000000 +0900 >+++ mozilla/gfx/src/ps/nsFontMetricsPango.cpp 2007-01-17 12:01:30.000000000 +0900 >@@ -1214,6 +1214,12 @@ nsFontMetricsPango::GetRangeWidth(const > > pango_layout_line_get_x_ranges(line, aStart, aEnd, &ranges, &n_ranges); > >+ if (ranges == NULL) { >+ /* this usually shouldn't be happened. it just appears if give >+ * the invalid range to pango_layout_line_get_x_ranges() >+ */ >+ return NS_ERROR_FAILURE; >+ } > aWidth = (ranges[((n_ranges - 1) * 2) + 1] - ranges[0]); > > f = mDeviceContext-> DevUnitsToAppUnits(); >diff -pruN -x '.moz*' -x 'firefox*' -x dist -x build -x 'config*' -x .libs -x .deps -x '*a' -x '*so' -x '*o' -x '*html' mozilla.orig/layout/generic/nsTextFrame.cpp mozilla/layout/generic/nsTextFrame.cpp >--- mozilla.orig/layout/generic/nsTextFrame.cpp 2007-01-11 18:00:04.000000000 +0900 >+++ mozilla/layout/generic/nsTextFrame.cpp 2007-01-17 12:05:12.000000000 +0900 >@@ -5195,6 +5195,15 @@ nsTextFrame::MeasureText(nsPresContext* > aTs.mNormalFont->GetMaxDescent(aTextData.mDescent); > } > PRBool firstWordDone = PR_FALSE; >+ union { >+ char* bp1; >+ PRUnichar* bp2; >+ } line, word; >+ PRUint32 bufLength = 0; >+ // Get next word/whitespace from the text >+ PRBool isWhitespace, wasTransformed; >+ PRInt32 wordLen, contentLen; >+ line.bp2 = nsnull; > for (;;) { > #ifdef IBMBIDI > if (nextBidi && (mContentLength <= 0) ) { >@@ -5207,19 +5216,28 @@ nsTextFrame::MeasureText(nsPresContext* > } > } > #endif // IBMBIDI >- // Get next word/whitespace from the text >- PRBool isWhitespace, wasTransformed; >- PRInt32 wordLen, contentLen; >- union { >- char* bp1; >- PRUnichar* bp2; >- }; > #ifdef IBMBIDI > wordLen = start; > #endif // IBMBIDI > >- bp2 = aTx.GetNextWord(aTextData.mInWord, &wordLen, &contentLen, &isWhitespace, >+ word.bp2 = aTx.GetNextWord(aTextData.mInWord, &wordLen, &contentLen, &isWhitespace, > &wasTransformed, textRun.mNumSegments == 0); >+ if (line.bp2 == nsnull) { >+ line.bp2 = (PRUnichar *)nsMemory::Alloc(sizeof (PRUnichar) * (contentLength + 1)); >+ NS_ASSERTION(buf, "not enough memory"); >+#if 1 >+ PRUint32 i; >+ for (i = 0, bufLength = 0; i < contentLength; i++) { >+ if (word.bp2[i] == '\n' && aTextData.mOffset > i) { >+ bufLength = 0; >+ continue; >+ } >+ line.bp2[bufLength++] = word.bp2[i]; >+ } >+#else >+ memcpy((void *)buf, bp2, sizeof (PRUnichar) * contentLength); >+#endif >+ } > > // We need to set aTextData.mCanBreakBefore to true after 1st word. But we can't set > // aTextData.mCanBreakBefore without seeing the 2nd word. That's because this frame >@@ -5244,7 +5262,7 @@ nsTextFrame::MeasureText(nsPresContext* > mState |= TEXT_WAS_TRANSFORMED; > } > >- if (bp2) { >+ if (word.bp2) { > if (firstWordDone) { > // The first word has been processed, and 2nd word is seen > // we can set it be breakable here after. >@@ -5265,15 +5283,15 @@ nsTextFrame::MeasureText(nsPresContext* > } > > lastWordLen = wordLen; >- lastWordPtr = bp2; >+ lastWordPtr = word.bp2; > aTextData.mInWord = PR_FALSE; > > // Measure the word/whitespace > PRUnichar firstChar; > if (aTx.TransformedTextIsAscii()) { >- firstChar = *bp1; >+ firstChar = *word.bp1; > } else { >- firstChar = *bp2; >+ firstChar = *word.bp2; > } > if (isWhitespace) { > if ('\n' == firstChar) { >@@ -5389,14 +5407,19 @@ nsTextFrame::MeasureText(nsPresContext* > } > else { > if (aTs.mSmallCaps) { >- MeasureSmallCapsText(aReflowState, aTs, bp2, wordLen, PR_FALSE, &dimensions); >+ MeasureSmallCapsText(aReflowState, aTs, word.bp2, wordLen, PR_FALSE, &dimensions); > } > else { > // Measure just the one word > if (aTx.TransformedTextIsAscii()) { >- aReflowState.rendContext->GetTextDimensions(bp1, wordLen, dimensions); >+ aReflowState.rendContext->GetTextDimensions(word.bp1, wordLen, dimensions); > } else { >- aReflowState.rendContext->GetTextDimensions(bp2, wordLen, dimensions); >+ aReflowState.rendContext->GetTextDimensions(word.bp2, wordLen, dimensions); >+ } >+ if (bufLength > 0) { >+ PRUint32 tmpWidth; >+ aReflowState.rendContext->GetRangeWidth(line.bp2, bufLength, aTextData.mOffset, aTextData.mOffset + wordLen, tmpWidth); >+ dimensions.width = tmpWidth; > } > #ifdef MOZ_MATHML > // If GetBoundingMetrics is available, use the exact glyph metrics >@@ -5406,9 +5429,9 @@ nsTextFrame::MeasureText(nsPresContext* > nsresult res; > nsBoundingMetrics bm; > if (aTx.TransformedTextIsAscii()) { >- res = aReflowState.rendContext->GetBoundingMetrics(bp1, wordLen, bm); >+ res = aReflowState.rendContext->GetBoundingMetrics(word.bp1, wordLen, bm); > } else { >- res = aReflowState.rendContext->GetBoundingMetrics(bp2, wordLen, bm); >+ res = aReflowState.rendContext->GetBoundingMetrics(word.bp2, wordLen, bm); > } > if (NS_SUCCEEDED(res)) { > aTextData.mAscent = dimensions.ascent = bm.ascent; >@@ -5485,6 +5508,11 @@ nsTextFrame::MeasureText(nsPresContext* > textRun.mBreaks, textRun.mNumSegments, > dimensions, numCharsFit, lastWordDimensions); > } >+ if (bufLength > 0) { >+ PRUint32 tmpWidth; >+ aReflowState.rendContext->GetRangeWidth(line.bp2, bufLength, aTextData.mOffset, aTextData.mOffset + textRun.mTotalNumChars, tmpWidth); >+ dimensions.width = tmpWidth; >+ } > // See how much of the text fit > if ((0 != aTextData.mX) && aTextData.mWrapping && (aTextData.mX + dimensions.width > maxWidth)) { > // None of the text fits >@@ -5567,7 +5595,7 @@ nsTextFrame::MeasureText(nsPresContext* > } > #endif // IBMBIDI > >- if (nsnull == bp2) { >+ if (nsnull == word.bp2) { > // No more text so we're all finished. Advance the offset in case the last > // call to GetNextWord() discarded characters > aTextData.mOffset += contentLen; >@@ -5674,6 +5702,13 @@ nsTextFrame::MeasureText(nsPresContext* > } > else { > aReflowState.rendContext->GetTextDimensions(pWordBuf, lastWordLen, lastWordDimensions); >+#if 0 >+ if (contentLength > 0) { >+ PRUint32 tmpWidth; >+ aReflowState.rendContext->GetRangeWidth(buf, contentLength, prevOffset, prevOffset + lastWordLen, tmpWidth); >+ lastWordDimensions.width = tmpWidth; >+ } >+#endif > if (aTs.mLetterSpacing) { > lastWordDimensions.width += aTs.mLetterSpacing * lastWordLen; > } >@@ -5737,6 +5772,8 @@ nsTextFrame::MeasureText(nsPresContext* > } > } > } >+ if (line.bp2) >+ nsMemory::Free(line.bp2); > > // Inform line layout of how this piece of text ends in whitespace > // (only text objects do this). Note that if x is zero then this
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 211660
:
143508
|
144058
|
144076
|
144257
|
144258
|
144888
| 145770 |
271071