Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. | |
| 3 * | 4 * |
| 4 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 6 * met: | 7 * met: |
| 7 * | 8 * |
| 8 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 11 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer | 12 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the | 13 * in the documentation and/or other materials provided with the |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 void HarfBuzzShaper::setFontFeatures() | 502 void HarfBuzzShaper::setFontFeatures() |
| 502 { | 503 { |
| 503 const FontDescription& description = m_font->fontDescription(); | 504 const FontDescription& description = m_font->fontDescription(); |
| 504 if (description.orientation() == Vertical) { | 505 if (description.orientation() == Vertical) { |
| 505 static hb_feature_t vert = { HarfBuzzFace::vertTag, 1, 0, static_cast<un signed>(-1) }; | 506 static hb_feature_t vert = { HarfBuzzFace::vertTag, 1, 0, static_cast<un signed>(-1) }; |
| 506 static hb_feature_t vrt2 = { HarfBuzzFace::vrt2Tag, 1, 0, static_cast<un signed>(-1) }; | 507 static hb_feature_t vrt2 = { HarfBuzzFace::vrt2Tag, 1, 0, static_cast<un signed>(-1) }; |
| 507 m_features.append(vert); | 508 m_features.append(vert); |
| 508 m_features.append(vrt2); | 509 m_features.append(vrt2); |
| 509 } | 510 } |
| 510 | 511 |
| 512 static const hb_tag_t kernTag = HB_TAG('k', 'e', 'r', 'n'); | |
| 513 static hb_feature_t kern = { kernTag, 1, 0, static_cast<unsigned>(-1) }; | |
| 514 static hb_feature_t noKern = { kernTag, 0, 0, static_cast<unsigned>(-1) }; | |
| 515 switch (description.kerning()) { | |
| 516 case FontDescription::NormalKerning: | |
| 517 m_features.append(kern); | |
|
behdad_google
2013/11/15 22:16:37
No need to explicitly turn on. Default is turned
| |
| 518 break; | |
| 519 case FontDescription::NoneKerning: | |
| 520 m_features.append(noKern); | |
| 521 break; | |
| 522 case FontDescription::AutoKerning: | |
| 523 break; | |
| 524 } | |
| 525 | |
| 511 FontFeatureSettings* settings = description.featureSettings(); | 526 FontFeatureSettings* settings = description.featureSettings(); |
| 512 if (!settings) | 527 if (!settings) |
| 513 return; | 528 return; |
| 514 | 529 |
| 515 unsigned numFeatures = settings->size(); | 530 unsigned numFeatures = settings->size(); |
| 516 for (unsigned i = 0; i < numFeatures; ++i) { | 531 for (unsigned i = 0; i < numFeatures; ++i) { |
| 517 hb_feature_t feature; | 532 hb_feature_t feature; |
| 518 String tag = settings->at(i).tag(); | 533 String tag = settings->at(i).tag(); |
| 519 feature.tag = HB_TAG(tag[0], tag[1], tag[2], tag[3]); | 534 feature.tag = HB_TAG(tag[0], tag[1], tag[2], tag[3]); |
| 520 feature.value = settings->at(i).value(); | 535 feature.value = settings->at(i).value(); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 if (!foundToX) | 889 if (!foundToX) |
| 875 toX = m_run.rtl() ? 0 : m_totalWidth; | 890 toX = m_run.rtl() ? 0 : m_totalWidth; |
| 876 | 891 |
| 877 // Using floorf() and roundf() as the same as mac port. | 892 // Using floorf() and roundf() as the same as mac port. |
| 878 if (fromX < toX) | 893 if (fromX < toX) |
| 879 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from X), height); | 894 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from X), height); |
| 880 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he ight); | 895 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he ight); |
| 881 } | 896 } |
| 882 | 897 |
| 883 } // namespace WebCore | 898 } // namespace WebCore |
| OLD | NEW |