OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. |
6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. | 6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
773 gc->drawTextBlob(blob, origin, paint); | 773 gc->drawTextBlob(blob, origin, paint); |
774 } | 774 } |
775 } | 775 } |
776 | 776 |
777 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* fallbackFonts, IntRectExtent* glyphBounds) const | 777 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* fallbackFonts, IntRectExtent* glyphBounds) const |
778 { | 778 { |
779 HarfBuzzShaper shaper(this, run, HarfBuzzShaper::NotForTextEmphasis, fallbac kFonts); | 779 HarfBuzzShaper shaper(this, run, HarfBuzzShaper::NotForTextEmphasis, fallbac kFonts); |
780 if (!shaper.shape()) | 780 if (!shaper.shape()) |
781 return 0; | 781 return 0; |
782 | 782 |
783 glyphBounds->setTop(ceilf(-shaper.glyphBoundingBox().y())); | 783 FloatRect glyphBoundingBox = shaper.glyphBoundingBox(); |
jbroman
2014/12/30 14:42:56
FWIW, these are both just members of HarfBuzzShape
h.joshi
2015/01/04 16:22:35
Removed these change in new patch.
Yes this change
| |
784 glyphBounds->setBottom(ceilf(shaper.glyphBoundingBox().maxY())); | 784 float totalWidth = shaper.totalWidth(); |
785 glyphBounds->setLeft(std::max<int>(0, ceilf(-shaper.glyphBoundingBox().x())) ); | |
786 glyphBounds->setRight(std::max<int>(0, ceilf(shaper.glyphBoundingBox().maxX( ) - shaper.totalWidth()))); | |
787 | 785 |
788 return shaper.totalWidth(); | 786 glyphBounds->setTop(ceilf(-glyphBoundingBox.y())); |
787 glyphBounds->setBottom(ceilf(glyphBoundingBox.maxY())); | |
788 glyphBounds->setLeft(std::max<int>(0, ceilf(-glyphBoundingBox.x()))); | |
789 glyphBounds->setRight(std::max<int>(0, ceilf(glyphBoundingBox.maxX() - total Width))); | |
790 | |
791 return totalWidth; | |
789 } | 792 } |
790 | 793 |
791 // Return the code point index for the given |x| offset into the text run. | 794 // Return the code point index for the given |x| offset into the text run. |
792 int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, | 795 int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, |
793 bool includePartialGlyphs) const | 796 bool includePartialGlyphs) const |
794 { | 797 { |
795 HarfBuzzShaper shaper(this, run); | 798 HarfBuzzShaper shaper(this, run); |
796 if (!shaper.shape()) | 799 if (!shaper.shape()) |
797 return 0; | 800 return 0; |
798 return shaper.offsetForPosition(xFloat); | 801 return shaper.offsetForPosition(xFloat); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
956 if (delta <= 0) | 959 if (delta <= 0) |
957 break; | 960 break; |
958 } | 961 } |
959 } | 962 } |
960 } | 963 } |
961 | 964 |
962 return offset; | 965 return offset; |
963 } | 966 } |
964 | 967 |
965 } // namespace blink | 968 } // namespace blink |
OLD | NEW |