コード例 #1
0
ファイル: formula.py プロジェクト: koreiklein/fantasia
    def render(self, context):
        dimension = 0
        if not context.covariant:
            dimension += 1
        if self.__class__ == Or:
            dimension += 1
        dimension = dimension % 2
        other_dimension = primitives._dual_dimension(dimension)

        length = distances.min_unit_divider_length
        values = []
        for kid in self.values:
            s = kid.render(context)
            length = max(length, s.widths()[other_dimension])
            values.append(s)
        return stack.stackAll(
            dimension,
            misc._interleave(self.renderDivider(context.covariant, length), values),
            spacing=distances.divider_spacing,
        )
コード例 #2
0
ファイル: formula.py プロジェクト: koreiklein/fantasia
 def render(self, context):
     quantifierStackingDimension = _dimension_for_variance(context.covariant)
     variableStackingDimension = primitives._dual_dimension(quantifierStackingDimension)
     if len(self.bindings) == 0:
         variablesStack = primitives.nullStack
     else:
         variablesStack, context = self.bindings[0].render(context)
         for binding in self.bindings[1:]:
             rendered_binding, context = binding.render(context)
             variablesStack = variablesStack.stack(
                 variableStackingDimension, rendered_binding, spacing=distances.quantifier_variables_spacing
             )
     kid = self.value.render(context)
     divider = primitives.quantifierDivider(
         context.covariant,
         max(kid.widths()[variableStackingDimension], variablesStack.widths()[variableStackingDimension]),
     )
     return variablesStack.stack(
         quantifierStackingDimension, divider, spacing=distances.quantifier_before_divider_spacing
     ).stack(quantifierStackingDimension, kid, spacing=distances.quantifier_after_divider_spacing)