mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
InstantPage: distinct per-level heading sizes
This commit is contained in:
parent
28763bb92d
commit
befacaa5fe
1 changed files with 17 additions and 5 deletions
|
|
@ -163,16 +163,28 @@ public final class InstantPageTheme {
|
|||
}
|
||||
|
||||
func headingTextAttributes(level: Int32, link: Bool) -> InstantPageTextAttributes {
|
||||
let clampedLevel = max(Int32(3), min(level, Int32(6)))
|
||||
let subheaderAttributes = self.textCategories.subheader
|
||||
guard clampedLevel > 3 else {
|
||||
return subheaderAttributes.withUnderline(link)
|
||||
let clampedLevel = max(Int32(1), min(level, Int32(6)))
|
||||
|
||||
// H1/H2 reuse the theme's existing big-text categories verbatim, so they
|
||||
// pick up the theme color, line-spacing, and any dynamic-type scaling.
|
||||
switch clampedLevel {
|
||||
case 1:
|
||||
return self.textCategories.header.withUnderline(link)
|
||||
case 2:
|
||||
return self.textCategories.subheader.withUnderline(link)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
// H3–H6: serif at a per-level base size, scaled by the same dynamic-type
|
||||
// multiplier the subheader category uses (subheader.size / 19.0).
|
||||
let subheaderAttributes = self.textCategories.subheader
|
||||
let baseSize: CGFloat
|
||||
switch clampedLevel {
|
||||
case 4:
|
||||
case 3:
|
||||
baseSize = 17.0
|
||||
case 4:
|
||||
baseSize = 16.0
|
||||
case 5:
|
||||
baseSize = 15.0
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue