Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Ability to choose font for text item #182

Open
tan-yong-sheng opened this issue Aug 24, 2022 · 3 comments
Open

Feature Request: Ability to choose font for text item #182

tan-yong-sheng opened this issue Aug 24, 2022 · 3 comments

Comments

@tan-yong-sheng
Copy link

Hi I found this is a great library to automate photoshop in order to make the flow automated. However, I still feel there is some functions still lacking there.

Feature Request:

  1. ability to choose font for the text item, e.g. Arial, League Spartan
  2. ability to centralize the text item horizontally or vertically
  3. ability to convert normal layer to smart object

Once again, thanks so much for the team's effort to create such useful library.

@blunderedbishop
Copy link

blunderedbishop commented Aug 29, 2022

You can see how to change a textbox's font in #176.
To change the direction or justification of the text you can look at the source code for text_item, in particular the direction and justification functions.

@TsXor
Copy link

TsXor commented Sep 8, 2022

This lib is COM binding, and if you want anything, please first check js reference and this js class relation mindmap
If you find a class is not in this lib, try following code to define it, and on most situations it should work out of the box:

from photoshop.api._core import Photoshop as pscore
class <the classname>(pscore):
    object_name = '<the classname>'

@Investigamer
Copy link
Contributor

@tys203831

You can set the font using its regular name like so:

import photoshop.api as ps
app = ps.Application()

layer = app.activeDocument.layers.getByName("My Text Layer")
layer.textItem.font = app.fonts.getByName("Font Name").postScriptName

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants