unload theme fonts on theme change
This commit is contained in:
1 parent
1d5201f1ab
commit
06c3ed6cc7
2 files changed
+37
No files matched your search
@@ -123,6 +123,11 @@ namespace Vocaluxe.Base
|
|||||||
fo.Dispose();
|
fo.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UnloadTexture()
|
||||||
|
{
|
||||||
|
CDraw.RemoveTexture(ref Texture);
|
||||||
|
}
|
||||||
|
|
||||||
private float GetFactor(char chr, TextFormatFlags flags)
|
private float GetFactor(char chr, TextFormatFlags flags)
|
||||||
{
|
{
|
||||||
if (CFonts.Style == EStyle.Normal)
|
if (CFonts.Style == EStyle.Normal)
|
||||||
@@ -277,6 +282,15 @@ namespace Vocaluxe.Base
|
|||||||
_htGlyphs.Add(chr, _Glyphs.Count - 1);
|
_htGlyphs.Add(chr, _Glyphs.Count - 1);
|
||||||
CFonts.Height = h;
|
CFonts.Height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UnloadAllGlyphs()
|
||||||
|
{
|
||||||
|
foreach (CGlyph glyph in _Glyphs)
|
||||||
|
{
|
||||||
|
glyph.UnloadTexture();
|
||||||
|
}
|
||||||
|
_Glyphs.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SFont
|
struct SFont
|
||||||
@@ -854,6 +868,27 @@ namespace Vocaluxe.Base
|
|||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void UnloadThemeFonts(string ThemeName)
|
||||||
|
{
|
||||||
|
if (_Fonts.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int Index = 0;
|
||||||
|
while (Index < _Fonts.Count)
|
||||||
|
{
|
||||||
|
if (_Fonts[Index].IsThemeFont && _Fonts[Index].ThemeName == ThemeName)
|
||||||
|
{
|
||||||
|
_Fonts[Index].Normal.UnloadAllGlyphs();
|
||||||
|
_Fonts[Index].Italic.UnloadAllGlyphs();
|
||||||
|
_Fonts[Index].Bold.UnloadAllGlyphs();
|
||||||
|
_Fonts[Index].BoldItalic.UnloadAllGlyphs();
|
||||||
|
_Fonts.RemoveAt(Index);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static int GetFontIndex(string ThemeName, string FontName)
|
private static int GetFontIndex(string ThemeName, string FontName)
|
||||||
{
|
{
|
||||||
if (ThemeName == String.Empty || FontName == String.Empty)
|
if (ThemeName == String.Empty || FontName == String.Empty)
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ namespace Vocaluxe.Screens
|
|||||||
_OldTheme = SelectSlides[htSelectSlides(SelectSlideTheme)].Selection;
|
_OldTheme = SelectSlides[htSelectSlides(SelectSlideTheme)].Selection;
|
||||||
|
|
||||||
CTheme.UnloadSkins();
|
CTheme.UnloadSkins();
|
||||||
|
CFonts.UnloadThemeFonts(CConfig.Theme);
|
||||||
CTheme.ListSkins();
|
CTheme.ListSkins();
|
||||||
CConfig.Skin = CTheme.SkinNames[0];
|
CConfig.Skin = CTheme.SkinNames[0];
|
||||||
_OldSkin = 0;
|
_OldSkin = 0;
|
||||||
@@ -205,6 +206,7 @@ namespace Vocaluxe.Screens
|
|||||||
_OldTheme = SelectSlides[htSelectSlides(SelectSlideTheme)].Selection;
|
_OldTheme = SelectSlides[htSelectSlides(SelectSlideTheme)].Selection;
|
||||||
|
|
||||||
CTheme.UnloadSkins();
|
CTheme.UnloadSkins();
|
||||||
|
CFonts.UnloadThemeFonts(CConfig.Theme);
|
||||||
CTheme.ListSkins();
|
CTheme.ListSkins();
|
||||||
CConfig.Skin = CTheme.SkinNames[0];
|
CConfig.Skin = CTheme.SkinNames[0];
|
||||||
_OldSkin = 0;
|
_OldSkin = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user