MCPcopy Create free account
hub / github.com/clips/pattern / LTTextLineHorizontal

Class LTTextLineHorizontal

pattern/web/pdf/layout.py:342–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340 raise NotImplementedError
341
342class LTTextLineHorizontal(LTTextLine):
343
344 def __init__(self, word_margin):
345 LTTextLine.__init__(self, word_margin)
346 self._x1 = +INF
347 return
348
349 def add(self, obj):
350 if isinstance(obj, LTChar) and self.word_margin:
351 margin = self.word_margin * obj.width
352 if self._x1 < obj.x0-margin:
353 LTContainer.add(self, LTAnon(' '))
354 self._x1 = obj.x1
355 LTTextLine.add(self, obj)
356 return
357
358 def find_neighbors(self, plane, ratio):
359 h = ratio*self.height
360 objs = plane.find((self.x0, self.y0-h, self.x1, self.y1+h))
361 return [ obj for obj in objs if isinstance(obj, LTTextLineHorizontal) ]
362
363class LTTextLineVertical(LTTextLine):
364

Callers 1

get_textlinesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…