From 8b679a2e892310e461c3f5028dfaf60b25eea37f Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Fri, 8 Oct 2021 16:00:33 -0700 Subject: fix(theme): consistent theme --- Makefile | 2 +- bin/status | 7 +- compile_commands.json | 182 +++++++++++++++++++++++++ include/libfont.h | 371 ++------------------------------------------------ sys/cmd/dwm/config.h | 10 +- sys/cmd/dwm/dwm.c | 8 +- sys/cmd/dwm/util.c | 2 +- sys/cmd/menu/config.h | 4 +- sys/cmd/rules.mk | 15 +- sys/cmd/term/config.h | 51 ++++--- sys/cmd/term/rules.mk | 7 +- sys/cmd/term/term.c | 1 - sys/rules.mk | 8 +- vendor/sync | 92 +++++++++++++ 14 files changed, 345 insertions(+), 415 deletions(-) diff --git a/Makefile b/Makefile index 0ef5b88..668ccda 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ ELIBS := -L$(LIB_DIR) -lc COMPILE = @echo "CC "$(@:$(OBJ_DIR)/%=%);\ $(CC) -MD $(CFLAGS) $(TCFLAGS) $(INCS) $(TCINCS) -o $@ -c $< LINK = @echo "LD "$(@:$(OBJ_DIR)/%=%);\ - $(CC) -MD $(CFLAGS) $(STATIC) $(TCFLAGS) -o $@ $(CINIT) $< $(CFINI) $(TCLIBS) $(ELIBS) + $(CC) -MD $(CFLAGS) $(STATIC) $(TCFLAGS) -o $@ $(CINIT) $< $(CFINI) $(TCLIBS) $(ELIBS) COMPLINK = @echo "CC "$(@:$(OBJ_DIR)/%=%);\ $(CC) -MD $(CFLAGS) $(STATIC) $(TCFLAGS) $(INCS) $(TCINCS) -o $@ $(CINIT) $^ $(CFINI) $(TCLIBS) $(ELIBS) ASSEMBLE = @echo "AS "$(@:$(OBJ_DIR)/%=%);\ diff --git a/bin/status b/bin/status index 2c0bf4c..9dfce79 100755 --- a/bin/status +++ b/bin/status @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # 1: last minute cpu() { @@ -70,7 +70,8 @@ ipaddr() { } dostatus() { - xsetroot -name "$VOL│$BAT│$MEM│$IP│$CPU│$NML│$WTR│$TIM" + xsetroot -name "$VOL│$MEM│$IP│$CPU│$NML│$WTR│$TIM" + # xsetroot -name "$VOL│$BAT│$MEM│$IP│$CPU│$NML│$WTR│$TIM" # echo "$VOL│$BAT│$MEM│$IP│$CPU│$NML│$WTR│$TIM" } @@ -138,7 +139,7 @@ done & refresh_volume refresh_weather refresh_ip -while true +while true do refresh_battery refresh_memory diff --git a/compile_commands.json b/compile_commands.json index 1a489d2..e77bb17 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -1482,5 +1482,187 @@ "sys/cmd/wm/wlr-layer-shell-unstable-v1-protocol.c" ], "file": "sys/cmd/wm/wlr-layer-shell-unstable-v1-protocol.c" + }, + { + "directory": "/home/nolln/root", + "arguments": [ + "gcc", + "-MD", + "-g", + "-march=native", + "-fno-strict-aliasing", + "-fwrapv", + "-fms-extensions", + "-Wno-microsoft-anon-tag", + "-I/usr/include/freetype2", + "-I/usr/include/libpng16", + "-I/usr/include/harfbuzz", + "-I/usr/include/glib-2.0", + "-I/usr/lib/glib-2.0/include", + "-I", + "include", + "-isystem", + "include/vendor/libc", + "-o", + ".build/sys/libfont/freetype.o", + "-c", + "sys/libfont/freetype.c" + ], + "file": "sys/libfont/freetype.c" + }, + { + "directory": "/home/nolln/root", + "arguments": [ + "gcc", + "-MD", + "-g", + "-march=native", + "-fno-strict-aliasing", + "-fwrapv", + "-fms-extensions", + "-Wno-microsoft-anon-tag", + "-I/home/nolln/root/include/vendor", + "-I/usr/include/libdrm", + "-I/usr/include/pixman-1", + "-I", + "include", + "-I", + "sys/cmd/wm", + "-o", + ".build/sys/cmd/wm/layer.o", + "-c", + "sys/cmd/wm/layer.c" + ], + "file": "sys/cmd/wm/layer.c" + }, + { + "directory": "/home/nolln/root", + "arguments": [ + "gcc", + "-MD", + "-g", + "-march=native", + "-fno-strict-aliasing", + "-fwrapv", + "-fms-extensions", + "-Wno-microsoft-anon-tag", + "-I/usr/include/freetype2", + "-I/usr/include/libpng16", + "-I/usr/include/harfbuzz", + "-I/usr/include/glib-2.0", + "-I/usr/lib/glib-2.0/include", + "-I/usr/include/freetype2", + "-I/usr/include/libpng16", + "-I/usr/include/harfbuzz", + "-I/usr/include/glib-2.0", + "-I/usr/lib/glib-2.0/include", + "-I", + "include", + "-o", + ".build/sys/cmd/term/hb.o", + "-c", + "sys/cmd/term/hb.c" + ], + "file": "sys/cmd/term/hb.c" + }, + { + "directory": "/home/nolln/root", + "arguments": [ + "gcc", + "-MD", + "-g", + "-march=native", + "-fno-strict-aliasing", + "-fwrapv", + "-fms-extensions", + "-Wno-microsoft-anon-tag", + "-I", + "include", + "-o", + ".build/sys/cmd/term2/xdg-shell-protocol.o", + "-c", + "sys/cmd/term2/xdg-shell-protocol.c" + ], + "file": "sys/cmd/term2/xdg-shell-protocol.c" + }, + { + "directory": "/home/nolln/root", + "arguments": [ + "gcc", + "-MD", + "-g", + "-march=native", + "-fno-strict-aliasing", + "-fwrapv", + "-fms-extensions", + "-Wno-microsoft-anon-tag", + "-I", + "include", + "-o", + ".build/sys/cmd/term2/util.o", + "-c", + "sys/cmd/term2/util.c" + ], + "file": "sys/cmd/term2/util.c" + }, + { + "directory": "/home/nolln/root", + "arguments": [ + "gcc", + "-MD", + "-g", + "-march=native", + "-fno-strict-aliasing", + "-fwrapv", + "-fms-extensions", + "-Wno-microsoft-anon-tag", + "-I", + "include", + "-o", + ".build/sys/cmd/term2/term.o", + "-c", + "sys/cmd/term2/term.c" + ], + "file": "sys/cmd/term2/term.c" + }, + { + "directory": "/home/nolln/root", + "arguments": [ + "gcc", + "-MD", + "-g", + "-march=native", + "-fno-strict-aliasing", + "-fwrapv", + "-fms-extensions", + "-Wno-microsoft-anon-tag", + "-I", + "include", + "-o", + ".build/sys/cmd/term2/gui.o", + "-c", + "sys/cmd/term2/gui.c" + ], + "file": "sys/cmd/term2/gui.c" + }, + { + "directory": "/home/nolln/root", + "arguments": [ + "gcc", + "-MD", + "-g", + "-march=native", + "-fno-strict-aliasing", + "-fwrapv", + "-fms-extensions", + "-Wno-microsoft-anon-tag", + "-I", + "include", + "-o", + ".build/sys/cmd/term2/main.o", + "-c", + "sys/cmd/term2/main.c" + ], + "file": "sys/cmd/term2/main.c" } ] diff --git a/include/libfont.h b/include/libfont.h index da44e76..a152545 100644 --- a/include/libfont.h +++ b/include/libfont.h @@ -1,363 +1,20 @@ #pragma once -typedef struct font·Info font·Info; -typedef struct font·TabElt font·TabElt; -typedef struct font·Vertex font·Vertex; -typedef struct font·Bitmap font·Bitmap; +typedef struct font·Data font·Data; +typedef struct font·Face font·Face; -struct font·TabElt +struct font·Face { - int glyph1; // use font·glyph_index - int glyph2; - int advance; + int width, height; + int ascent, descent; + struct{ + short l, r; + } bearing; + struct { + int slant : 1, weight : 1; + } bad; + + font·Data *data; // don't touch }; -enum -{ - font·Vmove = 1, - font·Vline, - font·Vcurve, - font·Vcubic -}; - -/* fixed point */ -struct font·Vertex -{ - slong x, y; - slong cx, cy; - slong cx1, cy1; - uchar type, padding; -}; - -/* glyph shapes */ - -/* Query the font vertical metrics without having to create a font first */ -void font·scaledvmetrics(uchar *data, int index, float size, float *ascent, float *descent, float *lineGap); - -/* - * This function will determine the number of fonts in a font file. TrueType - * collection (.ttc) files may contain multiple fonts, while TrueType font - * (.ttf) files only contain one font. The number of fonts can be used for - * indexing with the previous function where the index is between zero and one - * less than the total fonts. If an error occurs, -1 is returned. - */ -int font·number(uchar *data); - -/* - * Each .ttf/.ttc file may have more than one font. Each font has a sequential - * index number starting from 0. Call this function to get the font offset for - * a given index; it returns -1 if the index is out of range. A regular .ttf - * file will only define one font and it always be at offset 0, so it will - * return '0' for index 0, and -1 for all other indices. - */ -int font·offsetfor(uchar *data, int index); - -/* - * Given an offset into the file that defines a font, this function builds - * the necessary cached info for the rest of the system. Returns nil on failure. - */ -font·Info *font·make(uchar *data, int offset, mem·Allocator, void *heap); -void font·free(font·Info *info); - - -/* character to glyph-index conversion */ - -/* - * If you're going to perform multiple operations on the same character - * and you want a speed-up, call this function with the character you're - * going to process, then use glyph-based functions instead of the - * codepoint-based functions. - * Returns 0 if the character codepoint is not defined in the font. - */ -int font·glyph_index(font·Info *info, int codepoint); - - -/* character properties */ - -/* - * computes a scale factor to produce a font whose "height" is 'pixels' tall. - * Height is measured as the distance from the highest ascender to the lowest - * descender; in other words, it's equivalent to calling font·GetFontVMetrics - * and computing: - * scale = pixels / (ascent - descent) - * so if you prefer to measure height by the ascent only, use a similar calculation. - */ -float font·scaleheightto(font·Info *info, float pixels); - -/* - * computes a scale factor to produce a font whose EM size is mapped to - * 'pixels' tall. This is probably what traditional APIs compute, but - * I'm not positive. - */ -float font·scaleheighttoem(font·Info *info, float pixels); - -/* - * ascent is the coordinate above the baseline the font extends; descent - * is the coordinate below the baseline the font extends (i.e. it is typically negative) - * linegap is the spacing between one row's descent and the next row's ascent... - * so you should advance the vertical position by "*ascent - *descent + *lineGap" - * these are expressed in unscaled coordinates, so you must multiply by - * the scale factor for a given size - */ -void font·vmetrics(font·Info *info, int *ascent, int *descent, int *linegap); - - -/* the bounding box around all possible characters */ -void font·bbox(font·Info *info, int *x0, int *y0, int *x1, int *y1); - -/* - * leftSideBearing is the offset from the current horizontal position to the left edge of the character - * advanceWidth is the offset from the current horizontal position to the next horizontal position - * these are expressed in unscaled coordinates - */ -void font·code_hmetrics(font·Info *info, int codepoint, int *advance, int *lsb); - -/* an additional amount to add to the 'advance' value between ch1 and ch2 */ -int font·code_kernadvance(font·Info *info, int ch1, int ch2); - -/* Gets the bounding box of the visible part of the glyph, in unscaled coordinates */ -int font·code_box(font·Info *info, int codepoint, int *x0, int *y0, int *x1, int *y1); - -/* as above, but takes one or more glyph indices for greater efficiency */ -void font·glyph_hmetrics(font·Info *info, int glyph_index, int *advance, int *lsb); -int font·glyph_kernadvance(font·Info *info, int glyph1, int glyph2); -int font·glyph_box(font·Info *info, int glyph_index, int *x0, int *y0, int *x1, int *y1); - -/* - * Retrieves a complete list of all of the kerning pairs provided by the font - * font·kerntab never writes more than table_length entries and returns how many entries it did write. - * The table will be sorted by (a.glyph1 == b.glyph1)?(a.glyph2 < b.glyph2):(a.glyph1 < b.glyph1) - */ -int font·kerntablen(font·Info *info); -int font·kerntab(font·Info *info, font·TabElt *tab, int len); - -/* returns non-zero if nothing is drawn for this glyph */ -int font·glyph_empty(font·Info *info, int glyph_index); - -/* - * returns # of vertices and fills *vertices with the pointer to them - * these are expressed in "unscaled" coordinates - * - * the shape is a series of contours. Each one starts with - * a STBTT_moveto, then consists of a series of mixed - * STBTT_lineto and STBTT_curveto segments. A lineto - * draws a line from previous endpoint to its x,y; a curveto - * draws a quadratic bezier from previous endpoint to - * its x,y, using cx,cy as the bezier control point. - */ -int font·code_shape(font·Info *info, int unicode_codepoint, font·Vertex **vertices); -int font·glyph_shape(font·Info *info, int glyph_index, font·Vertex **vertices); - -/* frees the data allocated above */ -void font·freeshape(font·Info *info, font·Vertex *verts); - -/* - * fills svg with the character's SVG data. - * returns data size or 0 if SVG not found. - */ -int font·code_svg(font·Info *info, int unicode_codepoint, char **svg); -int font·glyph_svg(font·Info *info, int gl, char **svg); - -/* bitmap rendering */ - -/* frees the bitmap allocated below */ -void font·freebitmap(font·Info *info, uchar *bitmap); - -/* - * allocates a large-enough single-channel 8bpp bitmap and renders the - * specified character/glyph at the specified scale into it, with - * antialiasing. 0 is no coverage (transparent), 255 is fully covered (opaque). - * *width & *height are filled out with the width & height of the bitmap, - * which is stored left-to-right, top-to-bottom. - - * xoff/yoff are the offset it pixel space from the glyph origin to the top-left of the bitmap - */ -uchar *font·code_makebitmap(font·Info *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff); - -/* - * the same as font·code_makebitmap, but you can specify a subpixel shift for the character - */ -uchar *font·code_makebitmap_subpixel(font·Info *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff); - -/* - * the same as font·codepointbitmap, but you pass in storage for the bitmap - * in the form of 'output', with row spacing of 'out_stride' bytes. the bitmap - * is clipped to out_w/out_h bytes. Call font·codepointbbox to get the - * width and height and positioning info for it first. - */ -void font·code_fillbitmap(font·Info *info, uchar *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint); - -/* - * same as font·code_fillbitmap, but you can specify a subpixel shift for the character - */ -void font·code_fillbitmap_subpixel(font·Info *info, uchar *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint); - -/* - * same as font·fillbitmap_subpixel, but prefiltering is performed - * oversampling a font increases the quality by allowing higher-quality subpixel - * positioning, and is especially valuable at smaller text sizes. - */ -void font·code_fillbitmap_subpixel_prefilter(font·Info *info, uchar *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int codepoint); - -/* - * get the bbox of the bitmap centered around the glyph origin; so the - * bitmap width is ix1-ix0, height is iy1-iy0, and location to place - * the bitmap top left is (leftSideBearing*scale,iy0). - * (Note that the bitmap uses y-increases-down, but the shape uses - * y-increases-up, so CodepointBitmapBox and CodepointBox are inverted.) - */ -void font·code_bbox(font·Info *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1); - -/* - * same as font·GetCodepointBitmapBox, but you can specify a subpixel - * shift for the character - */ -void font·code_bbox_subpixel(font·Info *font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1); - -/* - * the following functions are equivalent to the above functions, but operate - * on glyph indices instead of Unicode codepoints (for efficiency) - */ -uchar *font·glyph_makebitmap(font·Info *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff); -uchar *font·glyph_makebitmap_subpixel(font·Info *info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int *width, int *height, int *xoff, int *yoff); -void font·glyph_fillbitmap(font·Info *info, uchar *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph); -void font·glyph_fillbitmap_subpixel(font·Info *info, uchar *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph); -void font·glyph_fillbitmap_subpixel_prefilter(font·Info *info, uchar *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int glyph); -void font·glyph_bbox(font·Info *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1); -void font·glyph_bbox_subpixel(font·Info *font, int glyph, float scale_x, float scale_y,float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1); - -/* signed distance function (or field) rendering */ - -/* frees the SDF bitmap allocated below */ -void font·freesdf(font·Info *info, uchar *bitmap); - -/* - * These functions compute a discretized SDF field for a single character, suitable for storing - * in a single-channel texture, sampling with bilinear filtering, and testing against - * larger than some threshold to produce scalable fonts. - * info -- the font - * scale -- controls the size of the resulting SDF bitmap, same as it would be creating a regular bitmap - * glyph/codepoint -- the character to generate the SDF for - * padding -- extra "pixels" around the character which are filled with the distance to the character (not 0), - * which allows effects like bit outlines - * onedge_value -- value 0-255 to test the SDF against to reconstruct the character (i.e. the isocontour of the character) - * pixel_dist_scale -- what value the SDF should increase by when moving one SDF "pixel" away from the edge (on the 0..255 scale) - * if positive, > onedge_value is inside; if negative, < onedge_value is inside - * width,height -- output height & width of the SDF bitmap (including padding) - * xoff,yoff -- output origin of the character - * return value -- a 2D array of bytes 0..255, width*height in size - * - * pixel_dist_scale & onedge_value are a scale & bias that allows you to make - * optimal use of the limited 0..255 for your application, trading off precision - * and special effects. SDF values outside the range 0..255 are clamped to 0..255. - * - * Example: - * scale = font·ScaleForPixelHeight(22) - * padding = 5 - * onedge_value = 180 - * pixel_dist_scale = 180/5.0 = 36.0 - * - * This will create an SDF bitmap in which the character is about 22 pixels - * high but the whole bitmap is about 22+5+5=32 pixels high. To produce a filled - * shape, sample the SDF at each pixel and fill the pixel if the SDF value - * is greater than or equal to 180/255. (You'll actually want to antialias, - * which is beyond the scope of this example.) Additionally, you can compute - * offset outlines (e.g. to stroke the character border inside & outside, - * or only outside). For example, to fill outside the character up to 3 SDF - * pixels, you would compare against (180-36.0*3)/255 = 72/255. The above - * choice of variables maps a range from 5 pixels outside the shape to - * 2 pixels inside the shape to 0..255; this is intended primarily for apply - * outside effects only (the interior range is needed to allow proper - * antialiasing of the font at *smaller* sizes) - * - * The function computes the SDF analytically at each SDF pixel, not by e.g. - * building a higher-res bitmap and approximating it. In theory the quality - * should be as high as possible for an SDF of this size & representation, but - * unclear if this is true in practice (perhaps building a higher-res bitmap - * and computing from that can allow drop-out prevention). - - * The algorithm has not been optimized at all, so expect it to be slow - * if computing lots of characters or very large sizes. - */ - - -uchar *font·glyph_sdf(font·Info *info, float scale, int glyph, int padding, uchar onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff); -uchar *font·code_sdf(font·Info *info, float scale, int codepoint, int padding, uchar onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff); - - -/* - * Finding the right font... - * - * You should really just solve this offline, keep your own tables - * of what font is what, and don't try to get it out of the .ttf file. - * That's because getting it out of the .ttf file is really hard, because - * the names in the file can appear in many possible encodings, in many - * possible languages, and e.g. if you need a case-insensitive comparison, - * the details of that depend on the encoding & language in a complex way - * (actually underspecified in truetype, but also gigantic). - * - * But you can use the provided functions in two possible ways: - * font·findmatchingfont() will use *case-sensitive* comparisons on - * unicode-encoded names to try to find the font you want; - * you can run this before calling font·init() - * - * font·getfontnamestring() lets you get any of the various strings - * from the file yourself and do your own comparisons on them. - * You have to have called font·init() first. - */ - - -/* - * returns the offset (not index) of the font that matches, or -1 if none - * if you use STBTT_MACSTYLE_DONTCARE, use a font name like "Arial Bold". - * if you use any other flag, use a font name like "Arial"; this checks - * the 'macStyle' header field; i don't know if fonts set this consistently - */ -int font·findmatch(uchar *fontdata, char *name, int flags); -#define FONT_MACSTYLE_DONTCARE 0 -#define FONT_MACSTYLE_BOLD 1 -#define FONT_MACSTYLE_ITALIC 2 -#define FONT_MACSTYLE_UNDERSCORE 4 -#define FONT_MACSTYLE_NONE 8 // <= not same as 0, this makes us check the bitfield is 0 - -/* - * returns the string (which may be big-endian double byte, e.g. for unicode) - * and puts the length in bytes in *length. - * - * some of the values for the IDs are below; for more see the truetype spec: - * http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html - * http://www.microsoft.com/typography/otspec/name.htm - */ - -char *font·name(font·Info *font, int *length, int platformID, int encodingID, int languageID, int nameID); - -enum { // platformID - font·platform_unicode = 0, - font·platform_mac = 1, - font·platform_iso = 2, -}; - -enum { // encodingID for STBTT_PLATFORM_ID_UNICODE - font·unicode_eid_unicode_1_0 = 0, - font·unicode_eid_unicode_1_1 = 1, - font·unicode_eid_iso_10646 = 2, - font·unicode_eid_unicode_2_0_bmp = 3, - font·unicode_eid_unicode_2_0_full = 4 -}; - -enum { // encodingID for STBTT_PLATFORM_ID_MAC; same as Script Manager codes - font·mac_eid_roman =0, font·mac_eid_arabic =4, - font·mac_eid_japanese =1, font·mac_eid_hebrew =5, - font·mac_eid_chinese_trad =2, font·mac_eid_greek =6, - font·mac_eid_korean =3, font·mac_eid_russian =7 -}; - -enum { // languageID for STBTT_PLATFORM_ID_MAC - font·mac_lang_english =0 , font·stbtt_mac_lang_japanese =11, - font·mac_lang_arabic =12, font·stbtt_mac_lang_korean =23, - font·mac_lang_dutch =4 , font·stbtt_mac_lang_russian =32, - font·mac_lang_french =1 , font·stbtt_mac_lang_spanish =6 , - font·mac_lang_german =2 , font·stbtt_mac_lang_swedish =5 , - font·mac_lang_hebrew =10, font·stbtt_mac_lang_chinese_simplified =33, - font·mac_lang_italian =3 , font·stbtt_mac_lang_chinese_trad =19 -}; +int font·load(char *, int, font·Face *); diff --git a/sys/cmd/dwm/config.h b/sys/cmd/dwm/config.h index d14aded..4af0de5 100644 --- a/sys/cmd/dwm/config.h +++ b/sys/cmd/dwm/config.h @@ -9,11 +9,11 @@ static int swallowfloating = 0; /* 1 will swallow floating by default static int showbar = 1; /* 0 means no bar */ static int topbar = 1; /* 0 means bottom bar */ static char *fonts[] = { "consolas:size=12" }; -static char col_gray1[] = "#323232"; -static char col_gray2[] = "#444444"; -static char col_gray3[] = "#bbbbbb"; -static char col_gray4[] = "#eeeeee"; -static char col_cyan[] = "#24aed8"; +static char col_gray1[] = "#504945"; +static char col_gray2[] = "#282828"; +static char col_gray3[] = "#fbf1c7"; +static char col_gray4[] = "#504945"; +static char col_cyan[] = "#83a598"; static char *colors[][3] = { /* fg bg border */ diff --git a/sys/cmd/dwm/dwm.c b/sys/cmd/dwm/dwm.c index a432ab8..0567650 100644 --- a/sys/cmd/dwm/dwm.c +++ b/sys/cmd/dwm/dwm.c @@ -313,19 +313,19 @@ drawbar(Monitor *m) Client *c; /* draw status first so it can be overdrawn by tags later */ - if (m == selmon) { /* status is only drawn on selected monitor */ + if(m == selmon) { /* status is only drawn on selected monitor */ drw_setscheme(drw, scheme[SchemeNorm]); tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); } - for (c = m->clients; c; c = c->next) { + for(c = m->clients; c; c = c->next) { occ |= c->tags; if (c->isurgent) urg |= c->tags; } x = 0; - for (i = 0; i < arrlen(tags); i++) { + for(i = 0; i < arrlen(tags); i++) { w = TEXTW(tags[i]); drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); @@ -339,7 +339,7 @@ drawbar(Monitor *m) drw_setscheme(drw, scheme[SchemeNorm]); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); - if ((w = m->ww - tw - x) > bh) { + if((w = m->ww - tw - x) > bh) { if (m->sel) { drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); diff --git a/sys/cmd/dwm/util.c b/sys/cmd/dwm/util.c index 46db60a..0db71cc 100644 --- a/sys/cmd/dwm/util.c +++ b/sys/cmd/dwm/util.c @@ -9,7 +9,7 @@ fatal(char *fmt, ...) { vfprintf(stderr, fmt, args); va_end(args); - if (fmt[0] && fmt[strlen(fmt)-1] == ':') { + if(fmt[0] && fmt[strlen(fmt)-1] == ':') { fputc(' ', stderr); perror(NULL); } else { diff --git a/sys/cmd/menu/config.h b/sys/cmd/menu/config.h index 1e14aa9..fb1614d 100644 --- a/sys/cmd/menu/config.h +++ b/sys/cmd/menu/config.h @@ -11,8 +11,8 @@ static const char *fonts[] = { static const char *prompt = "cmds"; /* -p option; prompt to the left of input field */ static const char *colors[SchemeLast][2] = { /* fg bg */ - [SchemeNorm] = { "#bbbbbb", "#323232" }, - [SchemeSel] = { "#eeeeee", "#24aed8" }, + [SchemeNorm] = { "#fbf1c7", "#504945" }, + [SchemeSel] = { "#504945", "#83a598" }, [SchemeOut] = { "#000000", "#00ffff" }, }; /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ diff --git a/sys/cmd/rules.mk b/sys/cmd/rules.mk index dc0ca08..250b1ac 100644 --- a/sys/cmd/rules.mk +++ b/sys/cmd/rules.mk @@ -8,11 +8,14 @@ include share/push.mk DIR := $(d)/dwm include $(DIR)/rules.mk -DIR := $(d)/tinywl -include $(DIR)/rules.mk +# DIR := $(d)/tinywl +# include $(DIR)/rules.mk -DIR := $(d)/wm -include $(DIR)/rules.mk +# DIR := $(d)/wm +# include $(DIR)/rules.mk + +# DIR := $(d)/test +# include $(DIR)/rules.mk DIR := $(d)/filter include $(DIR)/rules.mk @@ -23,8 +26,8 @@ include $(DIR)/rules.mk DIR := $(d)/term include $(DIR)/rules.mk -DIR := $(d)/term2 -include $(DIR)/rules.mk +# DIR := $(d)/term2 +# include $(DIR)/rules.mk DIR := $(d)/walk include $(DIR)/rules.mk diff --git a/sys/cmd/term/config.h b/sys/cmd/term/config.h index f638e8a..40bc759 100644 --- a/sys/cmd/term/config.h +++ b/sys/cmd/term/config.h @@ -99,43 +99,40 @@ float alpha = 0.98; /* Terminal colors (16 first used in escape sequence) */ static char *colorname[] = { - /* 8 normal colors */ - "#4e4e4e", - "#d68787", - "#5f865f", - "#d8af5f", - "#85add4", - "#d7afaf", - "#87afaf", - "#d0d0d0", - - /* 8 bright colors */ - "#626262", - "#d75f87", - "#87af87", - "#ffd787", - "#add4fb", - "#ffafaf", - "#87d7d7", - "#e4e4e4", + "#282828", /* hard contrast: #1d2021 / soft contrast: #32302f */ + "#ea6962", /* red */ + "#a9b665", /* green */ + "#d8a657", /* yellow */ + "#7daea3", /* blue */ + "#d3869b", /* magenta */ + "#89b482", /* cyan */ + "#d4be98", /* white */ + + "#928374", /* black */ + "#ef938e", /* red */ + "#bbc585", /* green */ + "#e1bb7e", /* yellow */ + "#9dc2ba", /* blue */ + "#e1acbb", /* magenta */ + "#a7c7a2", /* cyan */ + "#e2d3ba", /* white */ [255] = 0, /* more colors can be added after 255 to use with DefaultXX */ - "#cccccc", - "#555555", - "#3a3a3a", + "#fbf1c7", + "#3c3836", + "#555555", }; - /* * Default colors (colorname index) * foreground, background, cursor, reverse cursor */ -uint defaultfg = 7; -uint defaultbg = 258; -static uint defaultcs = 256; -static uint defaultrcs = 257; +uint defaultfg = 256; +uint defaultbg = 257; +static uint defaultcs = 15; +static uint defaultrcs = 258; /* * Default shape of cursor diff --git a/sys/cmd/term/rules.mk b/sys/cmd/term/rules.mk index 19fcdaf..ef340b3 100644 --- a/sys/cmd/term/rules.mk +++ b/sys/cmd/term/rules.mk @@ -11,13 +11,12 @@ include share/paths.mk include share/dynamic.mk $(BINS_$(d)): TCFLAGS = \ `$(PKG) --cflags fontconfig` \ - `$(PKG) --cflags freetype2` \ - `$(PKG) --cflags harfbuzz` + `$(PKG) --cflags freetype2` + $(BINS_$(d)): TCLIBS = \ `$(PKG) --libs fontconfig` \ `$(PKG) --libs freetype2` \ - `$(PKG) --libs harfbuzz` \ - -lm -lrt -lX11 -lutil -lXft -lXrender \ + -lm -lrt -lX11 -lutil -lXft -lXrender -lharfbuzz $(BINS_$(d)): $(OBJS_$(d)) $(OBJ_DIR)/sys/libn/libn.a $(COMPLINK) diff --git a/sys/cmd/term/term.c b/sys/cmd/term/term.c index 77ed5c2..6a73a8b 100644 --- a/sys/cmd/term/term.c +++ b/sys/cmd/term/term.c @@ -2107,7 +2107,6 @@ tputc(rune u) printf("%d + %d\n", gp->u, u); if(!hb_unicode_compose(hb_unicode_funcs_get_default(),gp->u, u, &nu)) { - assert(false); return; } diff --git a/sys/rules.mk b/sys/rules.mk index a45e8b3..dcaae06 100644 --- a/sys/rules.mk +++ b/sys/rules.mk @@ -17,14 +17,14 @@ include $(DIR)/rules.mk DIR := $(d)/libbio include $(DIR)/rules.mk -DIR := $(d)/libdraw -include $(DIR)/rules.mk +# DIR := $(d)/libdraw +# include $(DIR)/rules.mk # DIR := $(d)/libimage # include $(DIR)/rules.mk -# DIR := $(d)/libfont -# include $(DIR)/rules.mk +DIR := $(d)/libfont +include $(DIR)/rules.mk # DIR := $(d)/libterm # include $(DIR)/rules.mk diff --git a/vendor/sync b/vendor/sync index 96ae888..2a49a2b 100755 --- a/vendor/sync +++ b/vendor/sync @@ -182,6 +182,96 @@ build_wlroots() echo $WLROOTS_TAG > wlroots/build.tag } +# ------------------------------------------------------------------------ +# harfbuzz + +HARFBUZZ_URL="https://github.com/harfbuzz/harfbuzz.git" +HARFBUZZ_TAG="3.0.0" + +build_harfbuzz() +{ + git clone $HARFBUZZ_URL + cd harfbuzz && git checkout $HARFBUZZ_TAG + meson \ + --prefix=$ROOT \ + --includedir=include/vendor \ + --libdir=lib/vendor \ + --buildtype=minsize \ + -Ddefault_library=static\ + -Dglib=disabled \ + -Dgobject=disabled \ + -Ddocs=disabled \ + -Db_lto="true"\ + build/ \ + && ninja -C build/ \ + && meson install -C build + + mv $ROOT/lib/vendor/pkgconfig/* $ROOT/lib/pkgconfig + rm -rf $ROOT/lib/vendor/pkgconfig + + cd $VENDOR + echo $HARFBUZZ_TAG > harfbuzz/build.tag +} + +# ------------------------------------------------------------------------ +# freetype2 + +FREETYPE_URL="git clone https://gitlab.freedesktop.org/freetype/freetype.git" +FREETYPE_TAG="3.0.0" + +build_harfbuzz() +{ + git clone $HARFBUZZ_URL + cd harfbuzz && git checkout $HARFBUZZ_TAG + meson \ + --prefix=$ROOT \ + --includedir=include/vendor \ + --libdir=lib/vendor \ + --buildtype=minsize \ + -Ddefault_library=static\ + -Dglib=disabled \ + -Dgobject=disabled \ + -Ddocs=disabled \ + -Db_lto="true"\ + build/ \ + && ninja -C build/ \ + && meson install -C build + + mv $ROOT/lib/vendor/pkgconfig/* $ROOT/lib/pkgconfig + rm -rf $ROOT/lib/vendor/pkgconfig + + cd $VENDOR + echo $HARFBUZZ_TAG > harfbuzz/build.tag +} + +# ------------------------------------------------------------------------ +# fontconfig + +FONTCONFIG_URL="https://github.com/freedesktop/fontconfig.git" +FONTCONFIG_TAG="2.3.94" + +build_fontconfig() +{ + git clone $FONTCONFIG_URL + cd fontconfig && git checkout $FONTCONFIG_TAG + meson \ + --prefix=$ROOT \ + --includedir=include/vendor \ + --libdir=lib/vendor \ + -Ddefault_library=static \ + -Dtools=disabled \ + -Dtests=disabled \ + build/ \ + && ninja -C build/ \ + && meson install -C build + + mv $ROOT/lib/vendor/pkgconfig/* $ROOT/lib/pkgconfig + rm -rf $ROOT/lib/vendor/pkgconfig + + cd $VENDOR + echo $FONTCONFIG_TAG > fontconfig/build.tag +} + # ------------------------------------------------------------------------ # utility functions @@ -205,4 +295,6 @@ update musl $MUSL_TAG update blas $BLAS_TAG update zlib $ZLIB_TAG update wlroots $WLROOTS_TAG +update fontconfig $FONTCONFIG_TAG +# update harfbuzz $HARFBUZZ_TAG # update glfw $GLFW_TAG -- cgit v1.2.1