Hello from CopperSpice

Introduction

I was introduced to the CopperSpice project when I attended my first CppCon in 2017. They gave an awesome and detailed presentation about text encoding and their Unicode aware string library CsString. Afterwards, I subscribed to their YouTube channel and started following their project. During the last year I became an active contributor to the project and joined the team.

I learned a lot about working with CopperSpice and thought it would be valuable to share my knowledge through a series of blog posts. It is my goal to show C++ developers the advantages of using the CopperSpice libraries to build their (GUI) applications.

This post introduces the CopperSpice project. Subsequent posts will show how to set up your development environment, how to build applications, and how to design a GUI. After that I will dive into more advanced topics such as signals and slots, multithreading, and networking. I use Arch Linux for development, therefore this series will focus on the Linux platform.

What is CopperSpice?

The CopperSpice project was started by Barbara Geller and Ansel Sermersheim. However, the team has grown over the last several years and we look forward to others joining us. The project has gained momentum and visibility. In his CppCon 2019 keynote Bjarne Stroustrup recognized CopperSpice as a project making important contributions to the C++ ecosystem. In 2019 the team traveled throughout Europe for over two months and presented at a number of prominent conferences and C++ user groups.

So, what is CopperSpice then? CopperSpice is a set of individual libraries that together are used to develop cross-platform C++ (GUI) applications. This set of libraries is released under a LGPL 2.1 license. In addition to CopperSpice itself there are four standalone libraries, CsString, CsSignal, CsLibGuarded and CsPaint that are released under a BSD-2 license. These can be used on their own in any C++ application. For example, the STL’s std::string class does not handle Unicode or text encodings. CsString provides a header-only Unicode aware string library. If you are working with multithreading, CsLibGuarded helps protect your data from data races by encapsulating the data and the mutex protecting it.

The most recent library we released is CsPaint which provides an API on top of Vulkan and makes it much easier to develop graphics applications using C++. The long term plan is to use CsPaint for all the rendering, including text, in the CopperSpice GUI library. This is especially important for high DPI rendering. There is a video on the YouTube channel which provides a good introduction.

Looking at this project timeline shows the impressive pace at which the project is moving forward and making improvements. For those working on applications used internationally, one of the biggest improvements has been in string handling. CopperSpice (and CsString) moved from Unicode 8 to Unicode 11. We implemented major internal changes while updating to version 2 of Harfbuzz, significantly improving text shaping. This concluded the transition from UCS-2 (often confused with UTF-16) to UTF-8 for all strings. We also added support for POSIX and Perl regular expressions and stringviews.

Prior to version 1.6.1 CopperSpice supported two build systems, CMake and Autotools. The team decided CMake should be our only build system, and we moved to C++17 at the same time. We have also standardized a set of tiered subscriptions. As part of the subscription you will have access to our internal ticketing system which allows you to file priority tickets, get extended support, and help guide the direction of the project.

One of the guiding principles of the CopperSpice project is that releasing software as open source is fundamentally the right thing to do. This really resonates with me as a developer and avid user of open source software. All the code is available on GitHub and source distributions are available on our website. You can also find prebuilt binaries for a number of platforms there. The API documentation is extensive and detailed with lots of examples and code snippets. The overview documentation has a wealth of information about installing, supported platforms and migrating your applications to CopperSpice.

If you need further help you can create tickets or pull requests on GitHub or participate in the discussion on the forums. The team is always willing to listen to suggestions, open to change and happy to have a friendly discussion.

Where to go from here?

For those who want to get started immediately, I recommend going through the overview documentation and installing CopperSpice. If you prefer to build from source, building CopperSpice doesn’t take long and gets you an installation perfectly configured for your development environment. With an installation of CopperSpice in place, the next thing to check out is the KitchenSink application which contains over 30 demos.

For those who prefer to follow a tutorial, keep following this series of blog posts. The next set of posts will explain how to get your development environment set up and build applications using CopperSpice. I will also show how to compile CopperSpice yourself, which is especially useful if there is no binary (yet) for your chosen platform. As we conclude this series of posts, we will develop an application that deals with external data, visualizing information and handling user input. Stay tuned!