A simple Android library for exporting Egyptian hieroglyphic texts into images. It supports the GlyphX encoding as input and exports into the following file formats:
SVG(Scalable Vector Graphics)PNG(Portable Network Graphics)JPEG(Joint Photographic Experts Group)
This library is part of the Egyptian Writer Android App.
This library uses the GlyphX and code for encoding Hieroglyphs.
A library for converting GlyphX to MdC and back is stored here: GlyphConverter
Tip
If you want to display the hieroglyphs on Android, then you can use the THOTH-library:
ThothDroid/THOTH
Add this to your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Then add this dependency to your build.gradle.kts file:
dependencies {
implementation("com.github.ThothDroid:SESHAT:1.0.0")
}
Note
For the implementation for other build systems like Groovy see here
Download the SESHAT_versionname.aar file from the latest release, create a libs folder in your project directory and paste the file there. Then add this dependency to your build.gradle.kts file:
dependencies {
implementation(files("../libs/SESHAT_versionname.aar"))
}
Important
If you renamed the .aar file you also have to change the name in the dependencies
First, you have to initialize the library:
Seshat seshat = new Seshat(context, new Handler(context.getMainLooper()));
If you do not use the SeshatListener, you do not have to provide a Handler (you can just type null).
But for Thread safety, you should pass in the Handler of the UI-Thread, so that you can do UI Actions in the Listener,
even when the exporting is happening on another Thread. Of course, you can also provide a Handler of a different Thread.
If you are a beginner, leave it like in the example.
You can also provide the GlyphX-String now:
Seshat seshat = new Seshat(context, glyphX, new Handler(context.getMainLooper()));
Second, you set the export settings. You can manipulate each setting by a setter-function. Values you do not manipulate remain on the defaults.
Important
If you haven't done it already, last chance to set the GlyphX string via setGlyphX(String glyphX)
Now you can add a SeshatListener, to get updates about how the export process is going:
seshat.addSeshatListener(this); // Please make shure, to implement the Interface
It has these methods:
onExportStarted(): When the export process started. If you use a progressbar, then you should display it now.onExportProgress(int progress, int total): Called multiple times during export.progressrepresents the completed steps, whiletotalrepresents all steps needed. Please make this function fast and efficient, because it can slow down rendering.onPostProcessingStarted(): When the Post processing started (For example the rasterization). If you use a progress bar, set it into intermediate mode.onExportCompleted(): When the export is finished. Now you can hide the progressbar.
Finally, you can start the export process. It is recommended to do it in a separated Thread. Do not panic, you can still update UI-Components inside the Listener.
new Thread(() -> {
// If you want to export into a SVG String (To write it into a file)
String SVGString = seshat.convertToSVGString(title, description, cssBackground, backgroundTransparent);
// If you want to export into a SVG Document
Document SVGDocument = seshat.convertToSVGDocument(title, description, cssBackground, backgroundTransparent);
// If you want to export into a PNG File
File outputFile = new File(this.getFilesDir(), "output.png"); // Make shure you have the permission, to access the file path
seshat.convertToPNGFile(outputFile, width, height, quality, backgroundTransparent, autoSizeRatio);
// If you want to export into a JPEG File
File outputFile = new File(this.getFilesDir(), "output.jpg"); // Make shure you have the permission, to access the file path
seshat.convertToJPGFile(outputFile, width, height, quality, autoSizeRatio);
}).start();
The exported file is on the provided file path, or returned directly by the function.
Most of the settings come from the BoundProperty of the MAAT-Library, which calculates the positions of the signs.
Here I will explain all the possible export settings:
textSize: Height of one line of big hieroglyphs. Default:100pxverticalOrientation: This parameter can only have three values and defines the vertical position of smaller signs (liken): Default:1(Middle)0(Top): Put signs to the top of the line1(Middle): Center signs vertically2(Bottom): Drop signs on Baseline
writingDirection: This parameter only has two possible values and determines if the signs should be written from left to right or from right to left: Default:0(Left to right)0(Left to right): Write like in most European languages1(Right to left): Write like for example in Arabic
writingLayout: This parameter only has two possible values and determines if the signs should be written in lines or in columns: Default:0(Lines)0(Lines): Write signs in lines1(Columns): Write signs in columns
drawLines: If enabled, lines are drawn between the lines or columns of the text. Default:falseroundLineCap: If true, the ends of the lines between the text are rounded up. Default:truelineThickness: How thick the lines between the text are. Default:2pagePaddingLeft: The amount of free space left to the text. Default:0pagePaddingRight: The amount of free space right to the text. Default:0pagePaddingTop: The amount of free space above to the text. Default:0pagePaddingBottom: The amount of free space under to the text. Default:0signPadding: This value defines the padding between two signs which are not grouped Default:10layoutSignPadding: This value defines the relative space between two signs which are in the same group Default:5interLinePadding: This is the space between the lines or columns of the text Default:25backgroundColor: Defines the background color of the image. Default:#ffffffprimarySignColor: Defines the color of the hieroglyphs. Default:#000000
title: Contains the content for the title element in the SVG documentdescription: Contains the content for the description element in the SVG documentbackgroundWithCSS: If enabled, a style tag is attached to the<svg>-root Tag which colors the background. If disabled, a rect with width and height of100%is generated. For editing svg images or using them in the internet, the first option is more elegant. But the second option is compatible with more of the SVG renderers.backgroundTransparent: if true, the background will be transparent. If false, it will be filled with the specified background color
outputFile: The File to write the JPG image towidth: The width of the image in pixelsheight: The height of the image in pixelsquality: Value between0and100. It defines, how much the image is getting compressed. Smaller values mean smaller file size and bigger values mean better image quality (e.g. fewer artifacts)autoSizeRatio: If enabled, theheightvalue is ignored and replaced by a calculated height, based on thewidthand the ratio of the content.
Mostly the same as the JPEG settings, but with the backgroundTransparent setting from SVG.
Important
The version catalog uses this versioning system: see here.
First release of the library. Supports GlyphX import and SVG, PNG and JPEG export.
11.09.2026@1.0.0