Comments (2)
Splitting the parsing from the rendering is an excellent idea, though I've been thinking about a different approach than building a DOM tree: have the parser emit a stream of bytecodes to be read by a simple interpreter to build the attributed string. You could easily store the intermediate form to a file, send it over the wire, etc. Making it a documented format would make it easier to write all kinds of tools to feed data to an iOS app (and having your own simple representation means your code remains simple and memory-efficient.)
This would also simplify your unit testing. You could test the intermediate representation coming out of the parser, then have a few simple tests of the tool that converts the intermediate representation to an attributed string. It makes for a better separation of concerns and easier debugging.
My concern about the DOM tree comes down to memory usage (there are still plenty of 3G phones and 2G iPod Touches out there) and efficiently serializing and deserializing. I don't want to store the actual bytes from an OS X-encoded attributed string as I don't want to bet the two implementations will stay in sync. (Also, it would be nice for folks in Linux and Windows land to have a way to export rich text data in an easily processed format. It would be a major help in my field -- mobile learning tools.)
I'm willing to work on this on a branch if it doesn't conflict with work you're already doing. Kindly let me know.
from dtcoretext.
The existing method works well by having a "fleeting DOM" i.e. have a stack of DTHTMLElements. The stack could be removed and the copying for inheritance could be avoided by using the parent pointer consequently. But for now I am closing this issue because it is not something that can be immediately addressed.
from dtcoretext.
Related Issues (20)
- Picture position is invalid HOT 1
- Switch to Secure Object Archiving APIs
- Set spacing between lines.
- Disable bitcode HOT 1
- I have a improvement for support Image display, I think this change can be merged ? HOT 1
- Empty anchor element support HOT 5
- support for css rem HOT 2
- Found the crash of iOS, hope to get your help HOT 5
- XCode 14.3 warning when compiling DTCompatibility.h HOT 1
- DTCoreText support .xhtml file ? HOT 1
- issue crash when load html
- On iOS 16, enabling VoiceOver and rendering custom views using DTAttributedTextContentView causes crashes. HOT 7
- issue crash when load html
- "<" disappearing on iOS 16 HOT 1
- object tag can't display when it has child element
- set attribute .underLineColor is invalid
- Page data display may overlap
- Page data display may overlap
- DTCoreText can't draw underline in iOS18.
- iOS18 issue: paragraph spacing is losing?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dtcoretext.