R
R
Romanson2016-04-06 13:25:14
Delphi
Romanson, 2016-04-06 13:25:14

How to use two different fonts on Android in Delphi xe?

there is an article that describes the use of a True Type font for storing icons
link: https://delphifmandroid.blogspot.ru/2015/01/true-t...
Everything works fine, but here's the thing, I want to add the Lobster font as an additional one, and does not go ... although only the TTF font is specified in FMX.FontGlyphs.Android.pas to search for fonts, so it should also find my second one. what could be the problem?
font search code:

В uses добавьте модуль System.IOUtils
uses
  FMX.FontGlyphs, Androidapi.JNI.GraphicsContentViewText, System.IOUtils;
Спуститесь до 64 строки и добавьте новую переменную «FontFile: string;»
var
  TypefaceFlag: Integer;
  Typeface: JTypeface;
  FamilyName: JString;
  Metrics: JPaint_FontMetricsInt;
  FontFile: string;
На 85 строке закомментируйте строчку Typeface := TJTypeface.JavaClass.create(FamilyName, TypefaceFlag);
И добавьте ниже:
FontFile := TPath.GetDocumentsPath + PathDelim + CurrentSettings.Family + '.ttf';
if FileExists(FontFile) then
  Typeface := TJTypeface.JavaClass.createFromFile(StringToJString(FontFile))
else
  Typeface := TJTypeface.JavaClass.Create(FamilyName, TypefaceFlag);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Romanson, 2016-04-06
@Romanson

I understood everything, apparently in the eyes of the fuck, it is written that the Font is case sensitive. Thanks to all)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question