win32

Transparent Text

It's been almost three months since I posted the last Neatpad tutorial, and it's also been over a year since I started this project. During this time I have been steadily working on the migration to the Uniscribe API. Alot of issues have become apparent with the way I am rendering text in Neatpad, so this tutorial will hopefully highlight these issues and offer a solution. There isn't going to be any code-download this time as I will be incorporating the ideas presented here into subsequent tutorials (which will be about Uniscribe).

Unicode Text Editing

Design & Implementation of a Win32 Text Editor

Unicode character input presents some unique problems for text-editors - issues that did not have to be considered when the first ASCII editors were written. The main difficulties are the Unicode 'combining sequences' - where multiple code-points are combined to form a single selectable 'character cluster'. Modifications to a Unicode text-file require careful coding to ensure that character cluster-boundaries are preserved and that no invalid sequences are inadvertantly introduced into the document. The Uniscribe API will again be used to aid us in this area.

Piece Chains

Design & Implementation of a Win32 Text Editor

OK so I lied about getting the syntax-highlighting implemented this time around. I got bogged down in "regular expression hell" and needed something else to concentrate on. So during the summer period I've instead been slowly implementing Neatpad's text-editing capability. As I hinted at in the very first installment of this tutorial series, I have decided to follow the "Piece Table" design. The aim of this tutorial will be to discuss the rationale behind this decision and also highlight some (but not all) of the implementation details.

Win32 Tips & Tricks - Part 2

More useful tips for Win32 programming

Continuing on from the last part, here are more Win32 Tips and Tricks for you to browse.

XP Themes

Common-control manifests (which enable the XP themes) can be added to an executable in one of two ways:

Firstly, the manifest can be saved inside a file in the same directory as your executable. It must also have the same filename, with the text '.manifest' appended to the end:

AppName.exe
AppName.exe.manifest

The manifest is just a text file (in XML) and should look like this:

Keyboard Navigation

Design & Implementation of a Win32 Text Editor

Keeping with the Uniscribe theme brings us to the next area of Neatpad's development that hasn't been touched on yet, which is keyboard-input. I've deliberately left this stage until now because I knew that without Uniscribe keyboard-navigation would be very difficult indeed. The problem with keyboard-handling is not how to process keyboard input (which is easy), but rather how to navigate through a Unicode file - taking into account combining sequences, surrogates, graphaeme clusters etc.

Integrating UspLib

Design & Implementation of a Win32 Text Editor

It's finally here! - a new and improved Neatpad which demonstrates the rendering capabilities of UspLib. The purpose of this is tutorial to document the UspLib API, and secondly to mention a few details about how UspLib was integrated into Neatpad's code. I very much hope that the design of UspLib is good enough that it will others to import it into their own editors and get instant styled-text support!

Drawing styled text with Uniscribe

Design & Implementation of a Win32 Text Editor

The last tutorial saw the completion of the UspAnalyze function, one of the main APIs of the new UspLib text-rendering engine. We will now switch our attention to the implementation of the UspTextOut function. Our goal is to divide up the glyph-lists we ceated in the last tutorial, and apply colour information prior to display with ScriptTextOut. The method we will use to identify which colour belongs to each glyph is the central theme of this tutorial.

More Uniscribe Mysteries

Design & Implementation of a Win32 Text Editor

Uniscribe Mysteries continued...

We are going to pick up directly from where we left the last tutorial, in which we began to look at the Uniscribe API in detail. Remember that we are still working on the UspAnalyze function, and the sequence of events last time had led us to the point where we had broken a string of Unicode text into several item-runs. Below are the steps we made to get this far:

Uniscribe Mysteries

Design & Implementation of a Win32 Text Editor

The last tutorial presented a very brief overview of the Uniscribe ScriptString API. Unfortunately ScriptString is insufficient for our purposes with Neatpad because of the limitations of a single font and colour. The aim of this tutorial is to therefore investigate the "low-level" Uniscribe API. Because we have very specific requirements for Neatpad's text display our approach that of a multi-font, syntax-coloured text editor.

Introduction to Uniscribe

Design & Implementation of a Win32 Text Editor

Uniscribe is a low-level Win32 API that provides a high degree of control over the processing and display of Unicode text. The API is designed to provide a generic interface to all forms of Unicode text (complex or otherwise), and transparently handles properties such as bi-directional text and combining characters sequences.

Pages

Subscribe to RSS - win32