47 Accessible.role: Accessible.Graphic
48 Accessible.ignored: Accessible.name.length === 0
80 property int iconWidth: MD.Tokens.symbol.size
85 property int iconHeight: MD.Tokens.symbol.size
90 property color color: MD.Style.onBackgroundColor
95 property int style: Symbol.Style.Outlined
100 property int weight: Font.Normal
105 property bool fill: false
116 property int grade: Symbol.Grade.NormalEmphasis
123 property int opticalSize: Symbol.OpticalSize.Normal
126 property alias horizontalAlignment: text.horizontalAlignment
129 property alias verticalAlignment: text.verticalAlignment
131 implicitWidth: iconWidth
132 implicitHeight: iconHeight
144 renderType: icon.fill ? Text.NativeRendering : Text.QtRendering
147 switch (icon.style) {
148 case Symbol.Style.Rounded:
149 return MD.Theme.symbolsRoundedFontFamily;
151 return MD.Theme.symbolsSharpFontFamily;
152 case Symbol.Style.Outlined:
154 return MD.Theme.symbolsOutlinedFontFamily;
158 const gradeValues = [-25, 0, 200];
159 const weightValues = [Font.Thin, Font.ExtraLight, Font.Light, Font.Normal, Font.Medium, Font.DemiBold, Font.Bold];
160 const opticalSizes = [20, 24, 40, 48];
162 function closestValue(arr, val) {
165 if (val >= arr[arr.length - 1])
166 return arr[arr.length - 1];
167 for (let i = 0; i < arr.length; ++i) {
171 return arr[arr.length - 1];
175 "FILL": icon.fill ? 1 : 0,
176 "GRAD": closestValue(gradeValues, icon.grade),
177 "wght": closestValue(weightValues, icon.weight),
178 "opsz": closestValue(opticalSizes, icon.opticalSize)
181 font.pixelSize: Math.max(icon.iconWidth, icon.iconHeight) / scale
183 horizontalAlignment: Text.AlignHCenter
184 verticalAlignment: Text.AlignVCenter
187 textFormat: Text.PlainText
189 lineHeight: MD.Tokens.typescale.labelLarge.lineHeight
190 lineHeightMode: Text.FixedHeight
195 Accessible.ignored:
true
Material Symbols icon tokens.