Skip to main content
Mohamed Hameed21513110
Inspiring
August 24, 2023
Question

Display sample font chosen from a list

  • August 24, 2023
  • 1 reply
  • 674 views

Greetings to all
I have a simple question if possible
How can I add a sample width to a font inside Dialog?
To clarify more
I have, for example, a listbox or a drop-down list with fonts
I want, when choosing a font, to display a sample font, as shown in the image

 

-- The idea is how can I display the sample font

 

 

This topic has been closed for replies.

1 reply

Kevin Stohlmeyer
Community Expert
Community Expert
August 24, 2023

Hi @Mohamed Hameed21513110 what version of Photoshop are you on? What do you mean by "sample width"?

Current versions of Photoshop already show previews of the fonts.

This page explains more under the "Preview Fonts" section

https://helpx.adobe.com/photoshop/using/fonts.html

 

Mohamed Hameed21513110
Inspiring
August 25, 2023

To make it more clear
I want to change the font of Statik Text with the same idea as the sample font in Photoshop fonts
Is this method dependent on system fonts or is it based on Photoshop fonts?
And how to bring the font to change the font static text

I took screenshots that illustrate the idea more

    var myWindow = new Window ("dialog", "Font Test");
    var statictext1 = myWindow.add('statictext {text: "محمد حميد", characters: 20, justify: "left"}'); 
    statictext1.graphics.font = ScriptUI.newFont ("Ghalam1", 100);
    //statictext1.graphics.font = ScriptUI.newFont ("DIN Next LT Arabic", 100);
    //statictext1.graphics.font = ScriptUI.newFont ("Diwani Letter", 100);
    //statictext1.graphics.font = ScriptUI.newFont ("DTP Naskh S En", 100);
    //statictext1.graphics.font = ScriptUI.newFont ("Expo Arabic Light", 100);
    //statictext1.graphics.font = ScriptUI.newFont ("GE SS Two Bold", 100);
    //statictext1.graphics.font = ScriptUI.newFont ("GE Hili", 100);
    //statictext1.graphics.font = ScriptUI.newFont ("GE Meem Medium", 100);
     //statictext1.graphics.font = ScriptUI.newFont ("AL-Mateen", 100);
          myWindow.show ();

In the first picture, it is clear that the font written in the design is the same as the sample font in the list of fonts
It appears with me successfully in the first line of the code

statictext1.graphics.font = ScriptUI.newFont ("Ghalam1", 100);

 

 

This is the end result after trying the first line of code
Great result

 

But here

And when I try this font in this line, it doesn't work with it, and it shows me a problem

 statictext1.graphics.font = ScriptUI.newFont ("AL-Mateen", 100);

While the font appears in the text
Also, the same font appears in the list of fonts


Why didn't it appear with me when using the font inside the code

 

 

 

Summary of what I want
It is why there are fonts that change with me in the static text and there are others that do not change
where is the problem ??