Text presentation
From WikiSTEP
Attention This page is incomplete and covers only draft ideas on how best to interpret p46 entities around text.
The entity text_literal and its subtypes are giving basic, but incomplete information on how to display a text string.
ENTITY text_literal SUBTYPE OF (geometric_representation_item); literal : presentable_text; placement : axis2_placement; alignment : text_alignment; path : text_path; font : font_select; END_ENTITY; TYPE presentable_text = STRING; END_TYPE; TYPE text_alignment = label; END_TYPE; TYPE text_path = ENUMERATION (left, right, up, down ); END_TYPE; TYPE font_select = SELECT ( pre_defined_text_font, externally_defined_text_font, text_font); END_TYPE;
An assumption is that the selected font is defined in a specific size. E.g. for the most often used draughting_pre_defined_text_font <= pre_defined_text_font the initial hight of a capital ASCII character as used by ISO 3098-5 is 1.0 according to the geometric_representation_context of the subtype on the representation which refers to the text_literal as items, directly or indirectly. When the geometric_representation_context is used as a complex with global_unit_assigned_context the size is e.g. 1 mm or 1 inch dependent of the selected unit.
#378=TEXT_LITERAL(,'ABC',#381,'baseline left',.RIGHT.,#382);
#382=DRAUGHTING_PRE_DEFINED_TEXT_FONT('ISO 3098-1 font A');
Typically a text_literal is referred by a annotation_text_occurrence which may call out a TEXT_STYLE_WITH_BOX_CHARACTERISTICS via a PRESENTATION_STYLE_ASSIGNMENT with a BOX_HEIGHT of e.g. 3.5. This BOX_HEIGHT will scale up the size of the text_literal then to 3,5 mm or 3,5 inch respectively.
#385=TEXT_STYLE_WITH_BOX_CHARACTERISTICS(,#386,(BOX_HEIGHT(3.5)));
Text_literal does not explicitly state the character size to use. Because of this, the geometric extent for all the used characters in the string literal and taking care of the selected font is not known. But it is possible to use the subtype text_literal_with_extent:
ENTITY text_literal_with_extent
SUBTYPE OF (text_literal);
extent : planar_extent;
END_ENTITY;
ENTITY planar_extent
SUBTYPE OF (geometric_representation_item);
size_in_x : length_measure;
size_in_y : length_measure;
END_ENTITY;
ENTITY planar_box
SUBTYPE OF (planar_extent);
placement : axis2_placement;
END_ENTITY;
A useful interpretation of this subtype is that it states a requirement that the text to be displayed shall be displayed as big as possible so that it still completely fit in the specified box. This is a rather indirect definition and does not address details. Theses details are only given by text_style and subtypes. The extent give the width and height measured before the text may be rotated by the placement. There are two ways to get the final extent:
- either the extent is explicitly given by using the subtype text_literal_with_extent
- or the extent is only implicitly available by styling the text_literal with a BOX_HEIGHT (via annotation_text_occurrence and presentation_style_assignment) and a receiving system has to calculate the result. Different systems may come to slightly different results here.
- In the case BOX_WIDTH, BOX_SLANT_ANGLE or BOX_ROTATE_ANGLE is specified this has to be taken care as well.
Note that the additional geometric elements coming with the subtypes text_literal_with_associated_curves and text_literal_with_delineation may be outside of this extent.
The text is displayed around the placement point based on the alignment value. The following alignment values are recommended to ues:
'top right' 'top centre' 'top left' 'centre right' 'centre centre' 'centre left' 'bottom right' 'bottom centre' 'bottom left'
The value 'centre centre' means that the placement point is in the middle of the extent of the text_literal. Most often the placement point is on the 'bottom left' of the extent. (add diagram)
ENTITY text_literal_with_associated_curves
SUBTYPE OF (text_literal);
associated_curves : SET [1:?] OF curve;
END_ENTITY;
ENTITY text_literal_with_blanking_box
SUBTYPE OF (text_literal);
blanking : planar_box;
END_ENTITY;
ENTITY text_literal_with_delineation
SUBTYPE OF (text_literal);
delineation : text_delineation;
END_ENTITY;
ENTITY text_style;
name : label;
character_appearance : character_style_select;
END_ENTITY;
ENTITY text_style_with_box_characteristics
SUBTYPE OF (text_style);
characteristics : SET [1:4] OF box_characteristic_select;
WHERE
WR1: SIZEOF( QUERY( c1 <* SELF.characteristics |
SIZEOF( QUERY( c2 <* SELF.characteristics - c1 |
TYPEOF (c1) = TYPEOF (c2)
)) > 0
)) = 0;
END_ENTITY;
TYPE box_characteristic_select = SELECT (
box_height,
box_width,
box_slant_angle,
box_rotate_angle);
END_TYPE;
TYPE box_height = positive_ratio_measure; END_TYPE;
TYPE box_width = positive_ratio_measure; END_TYPE;
TYPE box_slant_angle = plane_angle_measure; END_TYPE;
TYPE box_rotate_angle = plane_angle_measure; END_TYPE;

