-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text annotation APIs #6572
Text annotation APIs #6572
Conversation
re font names:
|
even though existing connectors create Text Style Elements and TextAnnotationData and even refer to them by Id in other elements, nothing anywhere, including the connectors themselves can be using them for anything, right? I don't think we need to maintain any compatibility with them and can declare their types "obsolete". |
They are not treated as such by FontMap. |
Yup, that's a bug. They're required to be unique case insensitively. Surely if you search for "arial" you should find "Arial". |
Eww, using SQLite's definition of "case-insensitive"?
|
@aruniverse @ben-polinsky our release tags guidelines make conflicting statements about the
However, if I add I still don't understand why we need both "beta" and "preview". |
We are supposed to use the ICU extension for that. We ship it, but I don't see where it gets hooked up. Looks to me like that got lost somewhere. @khanaffan @chuckkir @jffmarker This isn't that important for font names, but is definitely required for code values. |
It gets linked into itwinbentley.dll in bentley.mke:
It is also used by the itwinlibxml2 partfile, although I'm not sure if it is used in the DLL itself. |
@pmconne Looking into the documentation link issues which don't seem like typos:
Word/camel hump order ( TypeDoc Reference Link Error: Reference to 'TextStyleApplyOptions' was not found at File: core-common/core/common/src/annotation/TextBlock.ts Line: 81 Spelling ( Invalid Link: "[Worksapce]($backend)" in file "reference/core-common/annotation/fractionrunprops"
Invalid Link: "[TextAnnotation2d]($common)" in file "reference/core-common/entities/textannotation2dprops" |
imodel-native: iTwin/imodel-native#718
This PR introduces support for creating and manipulating blocks of text, laying them out, and converting them to geometric primitives. It also provides straightforward APIs for querying and updating the text blocks stored on TextAnnotation2d/3d elements and updating their geometry streams.
It introduces the following APIs:
TextStyle (core-common)
Represents a text style obtained from a workspace. The TextStyle elements created by batch connectors are ignored. Text styles are identified by name.
TextBlock (core-common)
In-memory representation of a block of text, with content and styling. The wire format and persistence format are the same - JSON.
TextBlocks refer to fonts by name, not Id.
produceTextAnnotationGeometry (core-backend)
Processes a TextAnnotation and splits it into lines with word-wrapping. It then outputs primitive commands, namely: color changes, TextStrings, and fraction separators. This can be used to append a TextBlock to a geometry stream e.g. via
GeometryStreamBuilder.appendTextBlock
.This must be in core-backend because 1) it needs access to fonts and text styles stored in workspaces and font Ids stored in the iModel's font table; 2) it needs the native freetype library to layout glyphs; and 3) it needs the
Intl.Segmenter
API that despite being a Stage 4 ECMAScript proposal implemented in most other browsers and Node since 2020, is still not generally available in Firefox.TextAnnotation (core-common)
A TextBlock positioned in 2d or 3d space, typically attached to an element, though you can also use it to produce decoration graphics.
The BisCore schema and native code define an optional frame and leaders as part of the annotation. No one has ever used them, so they're omitted here, but they could be introduced in the future if needed without breaking the API. I expect dimensions will have their own representations of these, though.
TextAnnotation elements (core-backend)
These elements used to store their annotation in a separate aspect as a binary flatbuffer-encoded blob. Now, they store it directly as JSON in their
jsonProperties
field. AsetAnnotation
method updates this property and recomputes the geometry stream accordingly.dta text
keyinA lazy, quick-and-dirty, append-only text editing keyin. You can invoke the keyin with different commands+arguments in succession to build up a TextBlock displayed as a decoration graphic in the current viewport.
TODO
Follow-up