Bloom.Edit.EditingModel.GetFontAvailabilityMessage C# (CSharp) Method

GetFontAvailabilityMessage() public method

public GetFontAvailabilityMessage ( ) : string
return string
        public string GetFontAvailabilityMessage()
        {
            // REVIEW: does this ToLower() do the right thing on Linux, where filenames are case sensitive?
            var name = _collectionSettings.DefaultLanguage1FontName.ToLowerInvariant();

            if (null == FontFamily.Families.FirstOrDefault(f => f.Name.ToLowerInvariant() == name))
            {
                var s = LocalizationManager.GetString("EditTab.FontMissing",
                                                           "The current selected " +
                                                           "font is '{0}', but it is not installed on this computer. Some other font will be used.");
                return string.Format(s, _collectionSettings.DefaultLanguage1FontName);
            }
            return null;
        }

Usage Example

示例#1
0
        private void CheckFontAvailablility()
        {
            var fontMessage = _model.GetFontAvailabilityMessage();

            if (!string.IsNullOrEmpty(fontMessage))
            {
                Palaso.Reporting.ErrorReport.NotifyUserOfProblem(new ShowOncePerSessionBasedOnExactMessagePolicy(),
                                                                 fontMessage);
            }
        }