|
Lines 322-328
/webcore/platform/graphics/qt/FontQt.cpp_sec1
|
| 322 |
String sanitized = Font::normalizeSpaces(run.characters(), run.length()); |
325 |
String sanitized = Font::normalizeSpaces(run.characters(), run.length()); |
| 323 |
QString string = fromRawDataWithoutRef(sanitized); |
326 |
QString string = fromRawDataWithoutRef(sanitized); |
| 324 |
|
327 |
|
| 325 |
int w = QFontMetrics(font()).width(string); |
328 |
|
|
|
329 |
int shaperFlag = (m_fontDescription.orientation() == Vertical) ? Qt::Vertical : 0; |
| 330 |
|
| 331 |
int w = QFontMetrics(font()).width(string,shaperFlag); |
| 326 |
// WebKit expects us to ignore word spacing on the first character (as opposed to what Qt does) |
332 |
// WebKit expects us to ignore word spacing on the first character (as opposed to what Qt does) |
| 327 |
if (treatAsSpace(run[0])) |
333 |
if (treatAsSpace(run[0])) |
| 328 |
w -= m_wordSpacing; |
334 |
w -= m_wordSpacing; |
|
Lines 463-473
/webcore/platform/graphics/qt/FontQt.cpp_sec2
|
| 463 |
String sanitized = Font::normalizeSpaces(run.characters(), run.length()); |
470 |
String sanitized = Font::normalizeSpaces(run.characters(), run.length()); |
| 464 |
QString string = fromRawDataWithoutRef(sanitized); |
471 |
QString string = fromRawDataWithoutRef(sanitized); |
| 465 |
|
472 |
|
|
|
473 |
int shaperFlag = (m_fontDescription.orientation() == Vertical) ? Qt::Vertical : 0; |
| 474 |
|
| 466 |
QFontMetrics fm(font()); |
475 |
QFontMetrics fm(font()); |
| 467 |
float delta = position; |
476 |
float delta = position; |
| 468 |
int curPos = 0; |
477 |
int curPos = 0; |
| 469 |
do { |
478 |
do { |
| 470 |
float charWidth = fm.width(string[curPos]); |
479 |
float charWidth = fm.width(string[curPos],shaperFlag); |
| 471 |
delta -= charWidth; |
480 |
delta -= charWidth; |
| 472 |
if (includePartialGlyphs) { |
481 |
if (includePartialGlyphs) { |
| 473 |
if (delta + charWidth / 2 <= 0) |
482 |
if (delta + charWidth / 2 <= 0) |
|
Lines 493-499
/webcore/platform/graphics/qt/FontQt.cpp_sec3
|
| 493 |
String sanitized = Font::normalizeSpaces(run.characters(), run.length()); |
502 |
String sanitized = Font::normalizeSpaces(run.characters(), run.length()); |
| 494 |
QString string = fromRawDataWithoutRef(sanitized); |
503 |
QString string = fromRawDataWithoutRef(sanitized); |
| 495 |
|
504 |
|
| 496 |
int w = QFontMetrics(font()).width(string, -1, Qt::TextBypassShaping); |
505 |
int shaperFlag = 0; |
|
|
506 |
if(m_fontDescription.orientation() == Vertical) |
| 507 |
{ |
| 508 |
shaperFlag = Qt::TextBypassShaping | Qt::Vertical; |
| 509 |
} |
| 510 |
else |
| 511 |
{ |
| 512 |
shaperFlag = Qt::TextBypassShaping; |
| 513 |
} |
| 514 |
int w = QFontMetrics(font()).width(string, -1, shaperFlag); |
| 497 |
|
515 |
|
| 498 |
// WebKit expects us to ignore word spacing on the first character (as opposed to what Qt does) |
516 |
// WebKit expects us to ignore word spacing on the first character (as opposed to what Qt does) |
| 499 |
if (treatAsSpace(run[0])) |
517 |
if (treatAsSpace(run[0])) |
|
Lines 509-517
/webcore/platform/graphics/qt/FontQt.cpp_sec4
|
| 509 |
QString wholeText = fromRawDataWithoutRef(sanitized); |
527 |
QString wholeText = fromRawDataWithoutRef(sanitized); |
| 510 |
QString selectedText = fromRawDataWithoutRef(sanitized, from, qMin(to - from, wholeText.length() - from)); |
528 |
QString selectedText = fromRawDataWithoutRef(sanitized, from, qMin(to - from, wholeText.length() - from)); |
| 511 |
|
529 |
|
| 512 |
int startX = QFontMetrics(font()).width(wholeText, from, Qt::TextBypassShaping); |
530 |
int shaperFlag = 0; |
| 513 |
int width = QFontMetrics(font()).width(selectedText, -1, Qt::TextBypassShaping); |
531 |
if(m_fontDescription.orientation() == Vertical) |
| 514 |
|
532 |
{ |
|
|
533 |
shaperFlag = Qt::TextBypassShaping | Qt::Vertical; |
| 534 |
} |
| 535 |
else |
| 536 |
{ |
| 537 |
shaperFlag = Qt::TextBypassShaping; |
| 538 |
} |
| 539 |
int startX = QFontMetrics(font()).width(wholeText, from, shaperFlag); |
| 540 |
int width = QFontMetrics(font()).width(selectedText, -1, shaperFlag); |
| 515 |
return FloatRect(pt.x() + startX, pt.y(), width, h); |
541 |
return FloatRect(pt.x() + startX, pt.y(), width, h); |
| 516 |
} |
542 |
} |
| 517 |
|
543 |
|