Verify the font before converting to curves
Converting to curves is irreversible, so the order is fixed: set the font → wait 0.3 s → read it back → ConvertToCurves. If the check fails, skip the shape. Never co
Scenario
Verify the font before converting to curves
Notes
Converting to curves is irreversible, so the order is fixed: set the font → wait 0.3 s → read it back → ConvertToCurves. If the check fails, skip the shape. Never convert the wrong font.
Python example (runnable)
Requires
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & InitPython
import time
shape = app.ActiveSelectionRange(1)
TARGET = "Source Han Sans Bold"
ok = False
for _ in range(3):
shape.Text.Story.Characters.All.Font = TARGET
time.sleep(0.3)
if shape.Text.Story.Characters.All.Font == TARGET:
ok = True
break
if ok:
shape.ConvertToCurves() # only convert once the font is confirmed
print("Converted to curves")
else:
print("Font did not take; aborting the conversion so a wrong font is not baked in")
About this section: Recipes
Recipes — copy-paste ready workflows.
- This section has 6 entries; this is one of them.
- See the full section index: Recipes
Other entries in this section
- Throttling: why time.sleep(0.2) appears everywhereCorelDRAW is a single-threaded STA server. Python issues commands far
- Batch undo groupWrap big jobs in BeginCommandGroup / EndCommandGroup and one Ctrl+Z in
- Set font, read back, then fall backSee the code below. This is the most valuable pattern in the entire sc
- Process in index-range batchesWith a lot of JSON records, run start/end slices and print "total / pa
- Skip missing data instead of raisingif not img_find_in: skip_cnt += 1; continue — a missing image gets cou