일부 글꼴 (Times New Roman, 14)이 있고 문자열 너비를 측정해야합니다. 나는 API에서하기 matplotlib 예를 발견파이썬에서 문자열 길이 측정
from matplotlib import rcParams
import os.path
afm_filename = os.path.join(rcParams['datapath'], 'fonts', 'afm',
'ptmr8a.afm')
from matplotlib.afm import AFM
afm = AFM(open(afm_filename))
afm.string_width_height('What the heck?')
을하지만 내가 대신 "데이터 경로", "글꼴", "AFM"붙여 넣기해야하는지 이해할 수 없습니다. 파이썬에서 스팅 폭을 얻는 방법입니까? 어쩌면 다른 방법일까요?
문자열 폭은? 문자열의 길이를 의미합니까? – Jonathan
질문은 어디에 파일이 있습니까? –
문자열 길이는 픽셀 단위입니까? – RedEyed