diff --git a/Assets/RothenburgAR/Scripts/UI/FontsizeManager.cs b/Assets/RothenburgAR/Scripts/UI/FontsizeManager.cs index ed28809..4b8608d 100644 --- a/Assets/RothenburgAR/Scripts/UI/FontsizeManager.cs +++ b/Assets/RothenburgAR/Scripts/UI/FontsizeManager.cs @@ -7,37 +7,44 @@ namespace RothenburgAR.UI { public class FontsizeManager : Singleton { + private const float InchPerPt = 1f / 72f; + private const float PtPerPixel = 0.75f; + + // font size in pt relative to dpi specific logical inch private Dictionary sizes = new Dictionary { { - FontsizeClass.Header, 0.5f + FontsizeClass.Header, 25f }, { - FontsizeClass.Body, 0.2f + FontsizeClass.Body, 12f } }; - private void Start() - { - Debug.Log("Screen dpi: " + Screen.dpi); - } - + /// + /// Calculates font size that is roughly equal in size on "all" displays + /// public float GetFontsize(FontsizeClass sizeClass) { - var dpi = 420;//Screen.dpi; + var dpi = Screen.dpi; var res = Screen.currentResolution; + //TODO remove, just a hack to get readable fonts in the unity preview window + dpi = dpi == 96 ? 320 : dpi; + // Screen diagonal in px var diagonal = Mathf.Sqrt(Mathf.Pow(res.height, 2) + Mathf.Pow(res.width, 2)); // Screen diagonal in logical inches var diagonalIn = diagonal / dpi; - var ratio = diagonalIn * sizes[sizeClass]; - var fontsizePx = diagonal * ratio; - var fontsizePt = fontsizePx * 0.75f; + // ratio of font size to screen size + var ratio = sizes[sizeClass] * InchPerPt / diagonalIn; - return dpi * sizes[sizeClass]; + // final font size in pt + var fontsizePt = diagonal * ratio * PtPerPixel; + + return fontsizePt; } } diff --git a/Assets/RothenburgAR/Scripts/UI/FontsizeSelector.cs b/Assets/RothenburgAR/Scripts/UI/FontsizeSelector.cs index bc4d1ab..78e6a01 100644 --- a/Assets/RothenburgAR/Scripts/UI/FontsizeSelector.cs +++ b/Assets/RothenburgAR/Scripts/UI/FontsizeSelector.cs @@ -15,7 +15,7 @@ namespace RothenburgAR.UI { tmproText.enableAutoSizing = true; tmproText.fontSizeMax = FontsizeManager.Instance.GetFontsize(this.SizeClass); - tmproText.fontSizeMin = tmproText.fontSizeMax * 0.5f; + tmproText.fontSizeMin = tmproText.fontSizeMax * 0.8f; } } diff --git a/Assets/RothenburgAR/Scripts/Updater/UpdaterBehaviour.cs b/Assets/RothenburgAR/Scripts/Updater/UpdaterBehaviour.cs index e9c1a04..14c805f 100644 --- a/Assets/RothenburgAR/Scripts/Updater/UpdaterBehaviour.cs +++ b/Assets/RothenburgAR/Scripts/Updater/UpdaterBehaviour.cs @@ -13,6 +13,8 @@ namespace RothenburgAR.Updater { public UnityEngine.UI.Slider ProgressBar; + private float afterDownloadWaitTime = 300f; + public VersioncheckAnswer VersionAnswer { get; set; } private List httpHandlers = new List(); @@ -234,7 +236,6 @@ namespace RothenburgAR.Updater } private DateTime downloadEndedTime = DateTime.Now.AddSeconds(1); - private float afterDownloadWaitTime = 10f; void Update() { diff --git a/Assets/updaterScene.unity b/Assets/updaterScene.unity index 516fbc8..aceb8b8 100644 --- a/Assets/updaterScene.unity +++ b/Assets/updaterScene.unity @@ -720,7 +720,7 @@ RectTransform: m_Father: {fileID: 562107609} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.9} + m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} @@ -772,10 +772,10 @@ MonoBehaviour: m_outlineColor: serializedVersion: 2 rgba: 4278190080 - m_fontSize: 50.35 + m_fontSize: 38.4 m_fontSizeBase: 38.4 m_fontWeight: 400 - m_enableAutoSizing: 1 + m_enableAutoSizing: 0 m_fontSizeMin: 15 m_fontSizeMax: 1000 m_fontStyle: 0