1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +08:00

Merge pull request #13610 from gagahpangeran/markdown-heading-font-size

Change osu markdown heading to use actual font size
This commit is contained in:
Dan Balasescu 2021-06-22 20:58:48 +09:00 committed by GitHub
commit e39ce6cc67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 15 deletions

View File

@ -52,7 +52,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.618.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.616.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.622.0" />
</ItemGroup>
<ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->

View File

@ -20,7 +20,8 @@ namespace osu.Game.Graphics.Containers.Markdown
public override MarkdownTextFlowContainer CreateTextFlow() => new HeadingTextFlowContainer
{
Weight = GetFontWeightByLevel(level),
FontSize = GetFontSizeByLevel(level),
FontWeight = GetFontWeightByLevel(level),
};
protected override float GetFontSizeByLevel(int level)
@ -28,27 +29,25 @@ namespace osu.Game.Graphics.Containers.Markdown
// Reference for this font size
// https://github.com/ppy/osu-web/blob/376cac43a051b9c85ce95e2c446099be187b3e45/resources/assets/less/bem/osu-md.less#L9
// https://github.com/ppy/osu-web/blob/376cac43a051b9c85ce95e2c446099be187b3e45/resources/assets/less/variables.less#L161
const float base_font_size = 14;
switch (level)
{
case 1:
return 30 / base_font_size;
return 30;
case 2:
return 26 / base_font_size;
return 26;
case 3:
return 20 / base_font_size;
return 20;
case 4:
return 18 / base_font_size;
return 18;
case 5:
return 16 / base_font_size;
return 16;
default:
return 1;
return 14;
}
}
@ -67,9 +66,11 @@ namespace osu.Game.Graphics.Containers.Markdown
private class HeadingTextFlowContainer : OsuMarkdownTextFlowContainer
{
public FontWeight Weight { get; set; }
public float FontSize;
public FontWeight FontWeight;
protected override SpriteText CreateSpriteText() => base.CreateSpriteText().With(t => t.Font = t.Font.With(weight: Weight));
protected override SpriteText CreateSpriteText()
=> base.CreateSpriteText().With(t => t.Font = t.Font.With(size: FontSize, weight: FontWeight));
}
}
}

View File

@ -36,7 +36,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Realm" Version="10.2.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.616.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.622.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.618.0" />
<PackageReference Include="Sentry" Version="3.4.0" />
<PackageReference Include="SharpCompress" Version="0.28.2" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.616.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.622.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.618.0" />
</ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
@ -93,7 +93,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2021.616.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.622.0" />
<PackageReference Include="SharpCompress" Version="0.28.2" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="SharpRaven" Version="2.4.0" />