Fix font subsetting for webring
This commit is contained in:
parent
e2abb6873f
commit
86bd8a39ee
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
{% block content -%}
|
{% block content -%}
|
||||||
|
|
||||||
|
<h1>Archive</h1>
|
||||||
|
|
||||||
{% for year in years %}
|
{% for year in years %}
|
||||||
<div class="archive-list">
|
<div class="archive-list">
|
||||||
{% for entry in posts_by_year[year] %}
|
{% for entry in posts_by_year[year] %}
|
||||||
|
@ -359,8 +359,6 @@ footer {
|
|||||||
);
|
);
|
||||||
background: var(--webring-gradient);
|
background: var(--webring-gradient);
|
||||||
background-clip: text;
|
background-clip: text;
|
||||||
font-variant: small-caps;
|
|
||||||
font-weight: bold;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
&::after {
|
&::after {
|
||||||
content: "";
|
content: "";
|
||||||
|
@ -206,7 +206,7 @@ impl std::fmt::Debug for CharacterSets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
#[derive(Clone, Copy, PartialEq)]
|
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||||
pub struct FontKey: u8 {
|
pub struct FontKey: u8 {
|
||||||
const BOLD = 1;
|
const BOLD = 1;
|
||||||
const ITALIC = 1 << 1;
|
const ITALIC = 1 << 1;
|
||||||
|
@ -4,6 +4,7 @@ use compute_graph::{
|
|||||||
rule::Rule,
|
rule::Rule,
|
||||||
synchronicity::Asynchronous,
|
synchronicity::Asynchronous,
|
||||||
};
|
};
|
||||||
|
use log::debug;
|
||||||
use pyftsubset::subset;
|
use pyftsubset::subset;
|
||||||
|
|
||||||
use super::character_sets::{CharacterSets, FontKey};
|
use super::character_sets::{CharacterSets, FontKey};
|
||||||
@ -18,7 +19,11 @@ pub fn make_graph(
|
|||||||
sets: character_sets,
|
sets: character_sets,
|
||||||
key,
|
key,
|
||||||
});
|
});
|
||||||
builder.add_rule(SubsetFont { font, characters })
|
builder.add_rule(SubsetFont {
|
||||||
|
key,
|
||||||
|
font,
|
||||||
|
characters,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(InputVisitable)]
|
#[derive(InputVisitable)]
|
||||||
@ -36,12 +41,15 @@ impl Rule for GetCharacterSet {
|
|||||||
|
|
||||||
#[derive(InputVisitable)]
|
#[derive(InputVisitable)]
|
||||||
struct SubsetFont {
|
struct SubsetFont {
|
||||||
|
#[skip_visit]
|
||||||
|
key: FontKey,
|
||||||
font: Input<Vec<u8>>,
|
font: Input<Vec<u8>>,
|
||||||
characters: Input<ahash::HashSet<char>>,
|
characters: Input<ahash::HashSet<char>>,
|
||||||
}
|
}
|
||||||
impl Rule for SubsetFont {
|
impl Rule for SubsetFont {
|
||||||
type Output = Vec<u8>;
|
type Output = Vec<u8>;
|
||||||
fn evaluate(&mut self) -> Self::Output {
|
fn evaluate(&mut self) -> Self::Output {
|
||||||
|
debug!("Subsetting font {:?}", self.key);
|
||||||
let unicodes = self
|
let unicodes = self
|
||||||
.characters()
|
.characters()
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -208,7 +208,7 @@ impl Rule for RenderTemplate {
|
|||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Error rendering template {:?}: {:?}", self.name, e);
|
error!("Error rendering template {:?}: {:?}", self.name, e);
|
||||||
return String::new();
|
String::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user