New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 23 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 1
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment
link

Issue 331119: Support CSS3 font-stretch

Reported by e...@chromium.org, Dec 30 2013 Project Member

Issue description

We should add support for the CSS3 font-stretch property, it is part of the CSS Fonts Module Level 3 specification [1] and is supported in Firefox (since 9.0) [2] and IE (since 9.0) [3].

1: http://dev.w3.org/csswg/css3-fonts/#propdef-font-stretch
2: https://developer.mozilla.org/en-US/docs/Web/CSS/font-stretch
3: http://msdn.microsoft.com/en-us/library/ie/jj127324(v=vs.85).aspx
 

Comment 1 by e...@chromium.org, Jan 2 2014

Cc: e...@chromium.org

Comment 2 by bugdroid1@chromium.org, Mar 14 2014

Project Member
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=169264

------------------------------------------------------------------
r169264 | eae@chromium.org | 2014-03-14T17:57:50.946159Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/FontFaceSet.cpp?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/font-shorthand-from-longhands.html?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/StyleBuilderCustom.cpp?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/getComputedStyle/computed-style-font-family-expected.txt?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSPropertyNames.in?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/parser/CSSPropertyParser.cpp?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSShorthands.in?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/parser/CSSPropertyParser.h?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/font-shorthand-from-longhands-expected.txt?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/AnimatedStyleBuilder.cpp?r1=169264&r2=169263&pathrev=169264
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css3-text/font-stretch.html?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSFontValue.cpp?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/FontBuilder.cpp?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSComputedStyleDeclaration.cpp?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSFontValue.h?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSPrimitiveValueMappings.h?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/FontBuilder.h?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/StyleResolver.cpp?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/inspector/console/console-format-style-whitelist-expected.txt?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/getComputedStyle/computed-style-font-expected.txt?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/style/RenderStyle.cpp?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/getComputedStyle/script-tests/computed-style-font.js?r1=169264&r2=169263&pathrev=169264
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css3-text/font-stretch-expected.txt?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/inspector-support/style-expected.txt?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSProperties.in?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/style/RenderStyle.h?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/font-shorthand-expected.txt?r1=169264&r2=169263&pathrev=169264
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/StylePropertySerializer.cpp?r1=169264&r2=169263&pathrev=169264

Add plumbing for font-stretch

Implement support for parsing and querying the font-stretch CSS
property, for extracting the font-stretch from the short-hand font
property, and for querying the font-stretch through getComputedStyle.

Note that this patch does _not_ implement the font-stretch
functionality itself, it merely adds the required plumbing.

Request to implement thread:
  https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/N24I2zJemvI

Entry in Chromium Dashboard:
  http://www.chromestatus.com/features/4598830058176512

R=dglazkov@chromium.org
BUG= 331119 
TEST=fast/css3-text/font-stretch.html

Review URL: https://codereview.chromium.org/199423003
-----------------------------------------------------------------

Comment 3 by bugdroid1@chromium.org, Mar 14 2014

Project Member
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=169273

------------------------------------------------------------------
r169273 | zmo@chromium.org | 2014-03-14T20:27:38.454298Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/StyleResolver.cpp?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/FontBuilder.h?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/inspector/console/console-format-style-whitelist-expected.txt?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/getComputedStyle/computed-style-font-expected.txt?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/style/RenderStyle.cpp?r1=169273&r2=169272&pathrev=169273
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css3-text/font-stretch-expected.txt?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/getComputedStyle/script-tests/computed-style-font.js?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSProperties.in?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/inspector-support/style-expected.txt?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/style/RenderStyle.h?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/StylePropertySerializer.cpp?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/font-shorthand-expected.txt?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/font-shorthand-from-longhands.html?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/FontFaceSet.cpp?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/getComputedStyle/computed-style-font-family-expected.txt?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/StyleBuilderCustom.cpp?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSPropertyNames.in?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/parser/CSSPropertyParser.cpp?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSShorthands.in?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/AnimatedStyleBuilder.cpp?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/parser/CSSPropertyParser.h?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/font-shorthand-from-longhands-expected.txt?r1=169273&r2=169272&pathrev=169273
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css3-text/font-stretch.html?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSFontValue.cpp?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/FontBuilder.cpp?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSComputedStyleDeclaration.cpp?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSFontValue.h?r1=169273&r2=169272&pathrev=169273
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSPrimitiveValueMappings.h?r1=169273&r2=169272&pathrev=169273

Revert 169264 "Add plumbing for font-stretch"

Cause the below tests to crash on Linux Debug:

fast/dom/shadow/pseudoclass-update-checked-option.html,fast/dom/shadow/pseudoclass-update-disabled-option.html,fast/dom/shadow/pseudoclass-update-enabled-option.html

http://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20Oilpan%20%28dbg%29/builds/1058

> Add plumbing for font-stretch
> 
> Implement support for parsing and querying the font-stretch CSS
> property, for extracting the font-stretch from the short-hand font
> property, and for querying the font-stretch through getComputedStyle.
> 
> Note that this patch does _not_ implement the font-stretch
> functionality itself, it merely adds the required plumbing.
> 
> Request to implement thread:
>   https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/N24I2zJemvI
> 
> Entry in Chromium Dashboard:
>   http://www.chromestatus.com/features/4598830058176512
> 
> R=dglazkov@chromium.org
> BUG= 331119 
> TEST=fast/css3-text/font-stretch.html
> 
> Review URL: https://codereview.chromium.org/199423003

TBR=eae@chromium.org

Review URL: https://codereview.chromium.org/195823006
-----------------------------------------------------------------

Comment 4 by bugdroid1@chromium.org, Jul 25 2014

Project Member
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=178893

------------------------------------------------------------------
r178893 | eae@chromium.org | 2014-07-25T03:13:11.651698Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSProperty.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/font-shorthand-expected.txt?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/FontFaceSet.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/getComputedStyle/computed-style-font-family-expected.txt?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/StyleBuilderCustom.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/TestExpectations?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSShorthands.in?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/font-shorthand-from-longhands-expected.txt?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/AnimatedStyleBuilder.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/parser/CSSPropertyParser.h?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSFontValue.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSPrimitiveValueMappings.h?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/StyleResolver.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/FontBuilder.h?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/inspector/console/console-format-style-whitelist-expected.txt?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/getComputedStyle/computed-style-font-expected.txt?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/style/RenderStyle.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/inspector-support/style-expected.txt?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/animation/css/CSSPropertyEquality.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/StylePropertySerializer.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/parser/BisonCSSParser-in.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSValueKeywords.in?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/font-shorthand-from-longhands.html?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSPropertyNames.in?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/parser/CSSPropertyParser.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/first-letter-property-whitelist.html?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/animation/css/CSSAnimatableValueFactory.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/FontBuilder.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSComputedStyleDeclaration.cpp?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSFontValue.h?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/css/getComputedStyle/script-tests/computed-style-font.js?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSProperties.in?r1=178893&r2=178892&pathrev=178893
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/style/RenderStyle.h?r1=178893&r2=178892&pathrev=178893

Reland "Add plumbing for font-stretch"

Implement support for parsing and querying the font-stretch CSS
property, for extracting the font-stretch from the short-hand font
property, and for querying the font-stretch through getComputedStyle.

Note that this patch does _not_ implement the font-stretch
functionality itself, it merely adds the required plumbing.

Request to implement thread:
  https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/N24I2zJemvI

Entry in Chromium Dashboard:
  http://www.chromestatus.com/features/4598830058176512

Originally landed as r169264 and rolled out as r169273 due to
linux_blink_dbg test crashes.

R=dglazkov@chromium.org
BUG= 331119 
TEST=fast/css3-text/font-stretch.html

Review URL: https://codereview.chromium.org/203523002
-----------------------------------------------------------------

Comment 6 by bugdroid1@chromium.org, Aug 14 2014

Project Member
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=180305

------------------------------------------------------------------
r180305 | eae@chromium.org | 2014-08-14T23:30:58.379695Z

Changed paths:
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/text/font-stretch.html?r1=180305&r2=180304&pathrev=180305
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/TestExpectations?r1=180305&r2=180304&pathrev=180305
   M http://src.chromium.org/viewvc/blink/trunk/Source/platform/fonts/skia/FontCacheSkia.cpp?r1=180305&r2=180304&pathrev=180305

Implement support for CSS font-stretch on Windows

Implement support for the CSS font-stretch property on platforms using
SkFontMgr. This allows the width/stretch of a given font to be specified
and matches the IE and Firefox implementations.

Currently SkFontMgr is only used on Windows however as other platforms
migrate to SkFontMgr they'll get this support for free.

Entry in Chromium Dashboard:
  http://www.chromestatus.com/admin/features/edit/4598830058176512

Intent to Implement and Ship:
  https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/N24I2zJemvI/ZClPu585uAsJ
  
TEST=fast/text/font-stretch.html
BUG= 331119 
R=dglazkov@chromium.org

Review URL: https://codereview.chromium.org/476943003
-----------------------------------------------------------------

Comment 7 by cos...@gmail.com, Aug 16 2014

Is  Issue 347765  a duplicate of this?

This one has more stars, and commits associated with it. The other one is assigned.

Thoughts?

Comment 8 by e...@chromium.org, Aug 18 2014

 Issue 347765  has been merged into this issue.

Comment 9 by drott@chromium.org, Jul 20 2015

Cc: behdad@chromium.org kojii@chromium.org

Comment 10 by arcn...@gmail.com, Nov 13 2015

is comment #6 saying that support has been (or was) implemented on Windows already? Should this be working at least there now?

Thanks.

Comment 11 by dtapu...@chromium.org, Nov 13 2015

Labels: -Cr-Blink

Comment 12 by e...@chromium.org, Nov 16 2015

Blockedon: chromium:333354
Status: Available
Working on windows, support on other platforms is blocked on  issue 333354 .

Comment 13 by drott@chromium.org, Jun 30 2016

Cc: tomhud...@chromium.org

Comment 14 by bunge...@chromium.org, Jul 26 2016

This now works on Linux. "DejaVu Sans" normally comes in comes in (and is configured with) 5 and 3 widths (use `fc-list -f "%{family}\t%{width}\n" "DejaVu Sans" | sort` and look for differing numbers to ensure installed). As a result, when using one of the "font-stretch" enumeration values with "condensed" in the name (with "DejaVu Sans") will be narrower than without.

Mac still needs work. "American Typewriter" appears to be a good test case there.

Comment 15 by e...@chromium.org, Oct 10 2016

Blockedon: -333354

Comment 16 by e...@chromium.org, Oct 10 2016

Labels: -OS-All OS-Mac

Comment 17 by bunge...@chromium.org, Jul 25 2017

Cc: bunge...@chromium.org
Owner: drott@chromium.org
Skia fixed its own issues with weight and stretch on Mac not too long ago (see Skia commits 6e45bda29ed, f1ef1fa598c, 3e306f6bf40 ). However, the lookups on Mac are being done in FontCacheMac.mm / FontFamilyMatcherMac.mm which don't take the stretch (width) into account (though they do map the weights). At this point this should be fixable.

Comment 18 by laurence...@gmail.com, Jun 17 2018

font-stretch is not yet supported for variable fonts, where a % value is used. When writing code and planning for graceful fallback, it would be good if such support was testable. Unfortunately CSS.supports() incorrectly returns true with CSS.supports("font-stretch", "125%")). In fact, all % values are ignored.

Comment 20 by drott@chromium.org, Jun 19 2018

> font-stretch is not yet supported for variable fonts, where a % value is used. 

It is. Your example needs a font-stretch: line in the @font-face declaration, like: https://codepen.io/anon/pen/rKpZxK

Comment 21 by benhenry@chromium.org, Aug 2

Status: Assigned (was: Available)

Comment 22 by e...@chromium.org, Oct 1

Status: Fixed (was: Assigned)

Sign in to add a comment