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

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

Issue 77413003: Make -webkit-font-variant-ligatures actually work. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: reftests need ImageOnlyFailure, not Failure Created 6 years, 10 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
« no previous file with comments | « LayoutTests/fast/text/font-variant-ligatures-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 case FontDescription::NormalKerning: 514 case FontDescription::NormalKerning:
515 // kern/vkrn are enabled by default 515 // kern/vkrn are enabled by default
516 break; 516 break;
517 case FontDescription::NoneKerning: 517 case FontDescription::NoneKerning:
518 m_features.append(description.orientation() == Vertical ? noVkrn : noKer n); 518 m_features.append(description.orientation() == Vertical ? noVkrn : noKer n);
519 break; 519 break;
520 case FontDescription::AutoKerning: 520 case FontDescription::AutoKerning:
521 break; 521 break;
522 } 522 }
523 523
524 static hb_feature_t noClig = { HB_TAG('c', 'l', 'i', 'g'), 0, 0, static_cast <unsigned>(-1) };
525 static hb_feature_t noLiga = { HB_TAG('l', 'i', 'g', 'a'), 0, 0, static_cast <unsigned>(-1) };
526 switch (description.commonLigaturesState()) {
527 case FontDescription::DisabledLigaturesState:
528 m_features.append(noLiga);
529 m_features.append(noClig);
530 break;
531 case FontDescription::EnabledLigaturesState:
532 // liga and clig are on by default
533 break;
534 case FontDescription::NormalLigaturesState:
535 break;
536 }
537 static hb_feature_t dlig = { HB_TAG('d', 'l', 'i', 'g'), 1, 0, static_cast<u nsigned>(-1) };
538 switch (description.discretionaryLigaturesState()) {
539 case FontDescription::DisabledLigaturesState:
540 // dlig is off by default
541 break;
542 case FontDescription::EnabledLigaturesState:
543 m_features.append(dlig);
544 break;
545 case FontDescription::NormalLigaturesState:
546 break;
547 }
548 static hb_feature_t hlig = { HB_TAG('h', 'l', 'i', 'g'), 1, 0, static_cast<u nsigned>(-1) };
549 switch (description.historicalLigaturesState()) {
550 case FontDescription::DisabledLigaturesState:
551 // hlig is off by default
552 break;
553 case FontDescription::EnabledLigaturesState:
554 m_features.append(hlig);
555 break;
556 case FontDescription::NormalLigaturesState:
557 break;
558 }
559
524 FontFeatureSettings* settings = description.featureSettings(); 560 FontFeatureSettings* settings = description.featureSettings();
525 if (!settings) 561 if (!settings)
526 return; 562 return;
527 563
528 unsigned numFeatures = settings->size(); 564 unsigned numFeatures = settings->size();
529 for (unsigned i = 0; i < numFeatures; ++i) { 565 for (unsigned i = 0; i < numFeatures; ++i) {
530 hb_feature_t feature; 566 hb_feature_t feature;
531 const AtomicString& tag = settings->at(i).tag(); 567 const AtomicString& tag = settings->at(i).tag();
532 feature.tag = HB_TAG(tag[0], tag[1], tag[2], tag[3]); 568 feature.tag = HB_TAG(tag[0], tag[1], tag[2], tag[3]);
533 feature.value = settings->at(i).value(); 569 feature.value = settings->at(i).value();
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 if (!foundToX) 1065 if (!foundToX)
1030 toX = m_run.rtl() ? 0 : m_totalWidth; 1066 toX = m_run.rtl() ? 0 : m_totalWidth;
1031 1067
1032 // Using floorf() and roundf() as the same as mac port. 1068 // Using floorf() and roundf() as the same as mac port.
1033 if (fromX < toX) 1069 if (fromX < toX)
1034 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from X), height); 1070 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from X), height);
1035 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he ight); 1071 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he ight);
1036 } 1072 }
1037 1073
1038 } // namespace WebCore 1074 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/text/font-variant-ligatures-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698