January 4, 2018

Harfbuzz Adventures

Lately, I've been thinking about text layout in Rust. We'll get back to that at some point. This led to me to looking at the Rust bindings for Harfbuzz. Since then, I've started some submitting some fixes to the Rust bindings, including working towards updating to the current version of Harfbuzz. (This was a couple of weeks ago. Then I went on an extended holiday.)

Then, I decided to look at making some improvements upstream in Harfbuzz. I've now had a few minor patch submissions (#669, #670) accepted there as well and am working on more, including improving the support for the cmake build system.

One annoying thing is that since I use ninja as a build tool (instead of make), I have to modify many projects to include this bit of configuration (#674):

if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
  if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    set (CMAKE_CXX_FLAGS "-fcolor-diagnostics ${CMAKE_CXX_FLAGS}")
    set (CMAKE_C_FLAGS "-fcolor-diagnostics ${CMAKE_C_FLAGS}")
  endif ()
  if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    set (CMAKE_CXX_FLAGS "-fdiagnostics-color ${CMAKE_CXX_FLAGS}")
    set (CMAKE_C_FLAGS "-fdiagnostics-color ${CMAKE_C_FLAGS}")
  endif ()
endif ()

This gets old! I wish this could be fixed upstream somewhere, but I haven't had the time / motivation myself to think about this.

I also noticed when building on macOS that …

read more »

GraphQL beyond the Web

GraphQL is (from their site):

DECLARATIVE
Query responses are decided by the client rather than the server. A GraphQL query returns exactly what a client asks for and no more.
COMPOSITIONAL
A GraphQL query itself is a hierarchical set of fields. The query is shaped just like the data it returns. It is a natural way for product engineers to describe data requirements.
STRONG-TYPED
A GraphQL query can be ensured to be valid within a GraphQL type system at development time allowing the server to make guarantees about the response. This makes it easier to build high-quality client tools.

The GraphQL website has a lot of additional information, documentation, and some initial implementations.

I'm going to assume that you're at least roughly familiar with it, but as a quick example, this query:

{
  hero {
    id
    name
    friends {
      id
      name
    }
  }
}

This query could return something like:

{
  "data": {
    "hero": {
      "id": "2001",
      "name": "R2-D2",
      "friends": [
        {
          "id": "1000",
          "name": "Luke Skywalker"
        },
        {
          "id": "1002",
          "name": "Han Solo"
        },
        {
          "id": "1003",
          "name": "Leia Organa"
        }
      ]
    }
  }
}

A simpler query over the same data that is parameterized might look like:

query FetchSomeIDQuery($someId: String!) {
  human(id: $someId) {
    name
  }
}

And a response from that, given a value of 1000 for $someId would …

read more »

Finding a User Interface library

I'm building something for building developer tools. That's pretty vague, but I'd like to keep it that way for now. To do this, I wanted to use an existing user interface library. Unfortunately, it seems like it is always impossible to find what I want. I apparently want too much.

My Requirements

So, what am I looking for? These are just my own personal desires and I certainly don't expect that everyone will agree with them.

React
I'm planning to use React in my rendering layer, so it would be nice if the user interface framework that I use has solid support for React. This seems like a no-brainer. That said, there is another layer in my architecture which describes user interfaces and that is what gets lowered or converted to the actual widget definitions. In theory, this means that multiple view layers could exist (perhaps even using something like React Native). But for the start, I need solid React support.
TypeScript
Much like my desire for React support, I am writing my code in TypeScript. That doesn't mean that the UI has to be in TypeScript, but it would make it more convenient. Otherwise, typing definition files (.d.ts …
read more »

Querying OS Information

For a project that I'm working on, I would like to be able to retrieve information from the OS about a variety of things:

  • File system
  • Current processes running
  • Process memory maps
  • Open file handles in a process
  • File attributes
  • File type, mime type
  • ... and a lot more!

Some of these are very easy and are just a set of calls to POSIX functions. Others are highly dependent on the underlying platform.

I want to be able to access this data from an application that is either running natively or from within node.js when using Electron. I want it on a minimum of Mac OS X, Linux, FreeBSD and Windows. Support for other platforms such as NetBSD would be nice.

I don't want this to be very large. The overall code required is likely to be fairly small. Hopefully, a large number of dependencies would not be brought in by using a library that provides this information.

I want the data in JSON-LD format. This is JSON, but with some additional fields, like @type, that help my application present the data correctly. It would be nice if there were a way to subset the data such that some of …

read more »