Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp

Issue 263363005: Initial patch for FontVariant, variant like HalfWidth should take Complex Path (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@emoji_android
Patch Set: Updated test case Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 * Copyright (C) 2013 BlackBerry Limited. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 case FontDescription::DisabledLigaturesState: 510 case FontDescription::DisabledLigaturesState:
511 m_features.append(noCalt); 511 m_features.append(noCalt);
512 break; 512 break;
513 case FontDescription::EnabledLigaturesState: 513 case FontDescription::EnabledLigaturesState:
514 // calt is on by default 514 // calt is on by default
515 break; 515 break;
516 case FontDescription::NormalLigaturesState: 516 case FontDescription::NormalLigaturesState:
517 break; 517 break;
518 } 518 }
519 519
520 static hb_feature_t hwid = { HB_TAG('h', 'w', 'i', 'd'), 1, 0, static_cast<u nsigned>(-1) };
521 static hb_feature_t twid = { HB_TAG('t', 'w', 'i', 'd'), 1, 0, static_cast<u nsigned>(-1) };
522 static hb_feature_t qwid = { HB_TAG('d', 'w', 'i', 'd'), 1, 0, static_cast<u nsigned>(-1) };
523 switch (description.widthVariant()) {
524 case HalfWidth:
525 m_features.append(hwid);
526 break;
527 case ThirdWidth:
528 m_features.append(twid);
529 break;
530 case QuarterWidth:
531 m_features.append(qwid);
532 break;
533 case RegularWidth:
534 break;
535 }
536
520 FontFeatureSettings* settings = description.featureSettings(); 537 FontFeatureSettings* settings = description.featureSettings();
521 if (!settings) 538 if (!settings)
522 return; 539 return;
523 540
524 unsigned numFeatures = settings->size(); 541 unsigned numFeatures = settings->size();
525 for (unsigned i = 0; i < numFeatures; ++i) { 542 for (unsigned i = 0; i < numFeatures; ++i) {
526 hb_feature_t feature; 543 hb_feature_t feature;
527 const AtomicString& tag = settings->at(i).tag(); 544 const AtomicString& tag = settings->at(i).tag();
528 feature.tag = HB_TAG(tag[0], tag[1], tag[2], tag[3]); 545 feature.tag = HB_TAG(tag[0], tag[1], tag[2], tag[3]);
529 feature.value = settings->at(i).value(); 546 feature.value = settings->at(i).value();
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 if (!foundToX) 1127 if (!foundToX)
1111 toX = m_run.rtl() ? 0 : m_totalWidth; 1128 toX = m_run.rtl() ? 0 : m_totalWidth;
1112 1129
1113 // Using floorf() and roundf() as the same as mac port. 1130 // Using floorf() and roundf() as the same as mac port.
1114 if (fromX < toX) 1131 if (fromX < toX)
1115 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from X), height); 1132 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from X), height);
1116 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he ight); 1133 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he ight);
1117 } 1134 }
1118 1135
1119 } // namespace WebCore 1136 } // namespace WebCore
OLDNEW
« LayoutTests/fast/text/font-variant-width.html ('K') | « Source/platform/fonts/Font.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698