Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
841286d6
Unverified
Commit
841286d6
authored
May 28, 2019
by
Jason Simmons
Committed by
GitHub
May 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Framework support for font features in text styles (#33230)
See
https://github.com/flutter/flutter/issues/31691
parent
7c811b6a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
text_style.dart
packages/flutter/lib/src/painting/text_style.dart
+22
-1
theme_test.dart
packages/flutter/test/material/theme_test.dart
+3
-0
No files found.
packages/flutter/lib/src/painting/text_style.dart
View file @
841286d6
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:ui'
as
ui
show
ParagraphStyle
,
TextStyle
,
StrutStyle
,
lerpDouble
,
Shadow
;
import
'dart:ui'
as
ui
show
ParagraphStyle
,
TextStyle
,
StrutStyle
,
lerpDouble
,
Shadow
,
FontFeature
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -316,6 +316,7 @@ class TextStyle extends Diagnosticable {
this
.
foreground
,
this
.
background
,
this
.
shadows
,
this
.
fontFeatures
,
this
.
decoration
,
this
.
decorationColor
,
this
.
decorationStyle
,
...
...
@@ -562,6 +563,15 @@ class TextStyle extends Diagnosticable {
/// equivalent as order produces differing transparency.
final
List
<
ui
.
Shadow
>
shadows
;
/// A list of [FontFeature]s that affect how the font selects glyphs.
///
/// Some fonts support multiple variants of how a given character can be
/// rendered. For example, a font might provide both proportional and
/// tabular numbers, or it might offer versions of the zero digit with
/// and without slashes. [FontFeature]s can be used to select which of
/// these variants will be used for rendering.
final
List
<
ui
.
FontFeature
>
fontFeatures
;
/// Creates a copy of this text style but with the given fields replaced with
/// the new values.
///
...
...
@@ -588,6 +598,7 @@ class TextStyle extends Diagnosticable {
Paint
foreground
,
Paint
background
,
List
<
ui
.
Shadow
>
shadows
,
List
<
ui
.
FontFeature
>
fontFeatures
,
TextDecoration
decoration
,
Color
decorationColor
,
TextDecorationStyle
decorationStyle
,
...
...
@@ -619,6 +630,7 @@ class TextStyle extends Diagnosticable {
foreground:
foreground
??
this
.
foreground
,
background:
background
??
this
.
background
,
shadows:
shadows
??
this
.
shadows
,
fontFeatures:
fontFeatures
??
this
.
fontFeatures
,
decoration:
decoration
??
this
.
decoration
,
decorationColor:
decorationColor
??
this
.
decorationColor
,
decorationStyle:
decorationStyle
??
this
.
decorationStyle
,
...
...
@@ -718,6 +730,7 @@ class TextStyle extends Diagnosticable {
foreground:
foreground
,
background:
background
,
shadows:
shadows
,
fontFeatures:
fontFeatures
,
decoration:
decoration
??
this
.
decoration
,
decorationColor:
decorationColor
??
this
.
decorationColor
,
decorationStyle:
decorationStyle
??
this
.
decorationStyle
,
...
...
@@ -776,6 +789,7 @@ class TextStyle extends Diagnosticable {
foreground:
other
.
foreground
,
background:
other
.
background
,
shadows:
other
.
shadows
,
fontFeatures:
other
.
fontFeatures
,
decoration:
other
.
decoration
,
decorationColor:
other
.
decorationColor
,
decorationStyle:
other
.
decorationStyle
,
...
...
@@ -829,6 +843,7 @@ class TextStyle extends Diagnosticable {
background:
t
<
0.5
?
null
:
b
.
background
,
decoration:
t
<
0.5
?
null
:
b
.
decoration
,
shadows:
t
<
0.5
?
null
:
b
.
shadows
,
fontFeatures:
t
<
0.5
?
null
:
b
.
fontFeatures
,
decorationColor:
Color
.
lerp
(
null
,
b
.
decorationColor
,
t
),
decorationStyle:
t
<
0.5
?
null
:
b
.
decorationStyle
,
decorationThickness:
t
<
0.5
?
null
:
b
.
decorationThickness
,
...
...
@@ -854,6 +869,7 @@ class TextStyle extends Diagnosticable {
foreground:
t
<
0.5
?
a
.
foreground
:
null
,
background:
t
<
0.5
?
a
.
background
:
null
,
shadows:
t
<
0.5
?
a
.
shadows
:
null
,
fontFeatures:
t
<
0.5
?
a
.
fontFeatures
:
null
,
decoration:
t
<
0.5
?
a
.
decoration
:
null
,
decorationColor:
Color
.
lerp
(
a
.
decorationColor
,
null
,
t
),
decorationStyle:
t
<
0.5
?
a
.
decorationStyle
:
null
,
...
...
@@ -887,6 +903,7 @@ class TextStyle extends Diagnosticable {
:
b
.
background
??
(
Paint
()..
color
=
b
.
backgroundColor
)
:
null
,
shadows:
t
<
0.5
?
a
.
shadows
:
b
.
shadows
,
fontFeatures:
t
<
0.5
?
a
.
fontFeatures
:
b
.
fontFeatures
,
decoration:
t
<
0.5
?
a
.
decoration
:
b
.
decoration
,
decorationColor:
Color
.
lerp
(
a
.
decorationColor
,
b
.
decorationColor
,
t
),
decorationStyle:
t
<
0.5
?
a
.
decorationStyle
:
b
.
decorationStyle
,
...
...
@@ -919,6 +936,7 @@ class TextStyle extends Diagnosticable {
:
null
),
shadows:
shadows
,
fontFeatures:
fontFeatures
,
);
}
...
...
@@ -994,6 +1012,7 @@ class TextStyle extends Diagnosticable {
foreground
!=
other
.
foreground
||
background
!=
other
.
background
||
!
listEquals
(
shadows
,
other
.
shadows
)
||
!
listEquals
(
fontFeatures
,
other
.
fontFeatures
)
||
!
listEquals
(
fontFamilyFallback
,
other
.
fontFamilyFallback
))
return
RenderComparison
.
layout
;
if
(
color
!=
other
.
color
||
...
...
@@ -1032,6 +1051,7 @@ class TextStyle extends Diagnosticable {
decorationStyle
==
typedOther
.
decorationStyle
&&
decorationThickness
==
typedOther
.
decorationThickness
&&
listEquals
(
shadows
,
typedOther
.
shadows
)
&&
listEquals
(
fontFeatures
,
typedOther
.
fontFeatures
)
&&
listEquals
(
fontFamilyFallback
,
typedOther
.
fontFamilyFallback
);
}
...
...
@@ -1057,6 +1077,7 @@ class TextStyle extends Diagnosticable {
decorationColor
,
decorationStyle
,
shadows
,
fontFeatures
,
);
}
...
...
packages/flutter/test/material/theme_test.dart
View file @
841286d6
...
...
@@ -719,6 +719,8 @@ class _TextStyleProxy implements TextStyle {
double
get
wordSpacing
=>
_delegate
.
wordSpacing
;
@override
List
<
Shadow
>
get
shadows
=>
_delegate
.
shadows
;
@override
List
<
ui
.
FontFeature
>
get
fontFeatures
=>
_delegate
.
fontFeatures
;
@override
String
toString
({
DiagnosticLevel
minLevel
=
DiagnosticLevel
.
debug
})
=>
...
...
@@ -781,6 +783,7 @@ class _TextStyleProxy implements TextStyle {
ui
.
Paint
foreground
,
ui
.
Paint
background
,
List
<
Shadow
>
shadows
,
List
<
ui
.
FontFeature
>
fontFeatures
,
TextDecoration
decoration
,
Color
decorationColor
,
TextDecorationStyle
decorationStyle
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment