11
11
# - Dependencies -----------------------------------
12
12
from __future__ import print_function
13
13
import math
14
+ import warnings
14
15
from itertools import combinations
15
16
from operator import itemgetter
16
17
26
27
from typerig .core .objects .point import Point
27
28
from typerig .core .func .math import linInterp
28
29
30
+ from typerig .core .base .message import *
29
31
from typerig .proxy .fl .application .app import pWorkspace
30
32
from typerig .proxy .fl .objects .string import diactiricalMarks
31
33
32
34
# - Init -------------------------------------------
33
- __version__ = '0.30.8 '
35
+ __version__ = '0.30.9 '
34
36
35
37
# - Keep compatibility for basestring checks
36
38
try :
@@ -1497,6 +1499,10 @@ def _getPointArray(self, layer=None):
1497
1499
def _setPointArray (self , PointArray , layer = None , keep_center = False ):
1498
1500
nodeArray = self .nodes (layer )
1499
1501
PointArray = list (PointArray )
1502
+
1503
+ if len (PointArray ) != len (nodeArray ):
1504
+ warnings .warn ('Glyph: {}' .format (self .name ), TRPointArrayWarning )
1505
+ return
1500
1506
1501
1507
if keep_center :
1502
1508
layer_BBox = self .getBounds (layer )
@@ -1509,15 +1515,12 @@ def _setPointArray(self, PointArray, layer=None, keep_center=False):
1509
1515
center_array = pqt .QtCore .QPointF ((array_BBox [0 ] + array_BBox [2 ])/ 2. , (array_BBox [1 ] + array_BBox [3 ])/ 2 )
1510
1516
recenter_shift = layer_center - center_array
1511
1517
1512
- if len (PointArray ) == len (nodeArray ):
1513
- for nid in range (len (PointArray )):
1514
- if keep_center :
1515
- nodeArray [nid ].x = PointArray [nid ][0 ] + recenter_shift .x ()
1516
- nodeArray [nid ].y = PointArray [nid ][1 ] + recenter_shift .y ()
1517
- else :
1518
- nodeArray [nid ].x , nodeArray [nid ].y = PointArray [nid ]
1519
- else :
1520
- print ('ERROR:\t Incompatible coordinate array provided.' )
1518
+ for nid in range (len (PointArray )):
1519
+ if keep_center :
1520
+ nodeArray [nid ].x = PointArray [nid ][0 ] + recenter_shift .x ()
1521
+ nodeArray [nid ].y = PointArray [nid ][1 ] + recenter_shift .y ()
1522
+ else :
1523
+ nodeArray [nid ].x , nodeArray [nid ].y = PointArray [nid ]
1521
1524
1522
1525
def _getServiceArray (self , layer = None ):
1523
1526
layer_advance = [(float (self .layer (layer ).advanceWidth ), float (self .layer (layer ).advanceHeight ))]
@@ -1527,21 +1530,21 @@ def _getServiceArray(self, layer=None):
1527
1530
def _setServiceArray (self , PointArray , layer = None , set_metrics = True , set_anchors = True ):
1528
1531
PointArray = list (PointArray )
1529
1532
1530
- if len (PointArray ) > 2 :
1531
- if set_metrics :
1532
- layer_advance = PointArray [0 ]
1533
- self .setAdvance (layer_advance [0 ], layer )
1533
+ if len (PointArray ) == 0 :
1534
+ warnings .warn ('Glyph: {}' .format (self .name ), TRServiceArrayWarning )
1535
+ return
1534
1536
1535
- if set_anchors :
1536
- layer_anchors = PointArray [1 : ]
1537
- anchorArray = self .anchors ( layer )
1537
+ if set_metrics :
1538
+ layer_advance = PointArray [0 ]
1539
+ self .setAdvance ( layer_advance [ 0 ], layer )
1538
1540
1539
- if len (layer_anchors ) == len (anchorArray ):
1540
- for aid in range (len (layer_anchors )):
1541
- anchorArray [aid ].point = pqt .QtCore .QPointF (* layer_anchors [aid ])
1542
- else :
1543
- print ('ERROR:\t Incompatible coordinate array provided.' )
1541
+ if set_anchors and len (PointArray ) > 2 :
1542
+ layer_anchors = PointArray [1 :]
1543
+ anchorArray = self .anchors (layer )
1544
1544
1545
+ if len (layer_anchors ) == len (anchorArray ):
1546
+ for aid in range (len (layer_anchors )):
1547
+ anchorArray [aid ].point = pqt .QtCore .QPointF (* layer_anchors [aid ])
1545
1548
1546
1549
# - Nodes ----------------------------------------------
1547
1550
def breakContour (self , contourId , nodeId , layer = None , expand = 0 ):
0 commit comments