Skip to content

Commit d2b96ae

Browse files
committed
fix
1 parent aeb6031 commit d2b96ae

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

meme_generator/src/search.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ pub fn search_memes(query: &str, include_tags: bool) -> Vec<String> {
2323
for keyword in info.keywords {
2424
score = max(score, matcher.fuzzy_match(&keyword, &query));
2525
}
26+
for shortcut in info.shortcuts {
27+
score = max(score, matcher.fuzzy_match(&shortcut.pattern, &query));
28+
if let Some(humanized) = &shortcut.humanized {
29+
score = max(score, matcher.fuzzy_match(humanized, &query));
30+
}
31+
}
2632
if include_tags {
2733
for tag in info.tags {
2834
score = max(score, matcher.fuzzy_match(&tag, &query));

meme_generator/src/tools/render_statistics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,15 @@ fn draw_bar_chart(title: &str, data: Vec<(String, i32)>) -> Image {
272272
}
273273

274274
// 绘制 y 轴标签
275-
let mut y = MARGIN + y_grid_padding;
275+
let mut y = chart_height - MARGIN - y_grid_padding;
276276
let x = margin_left - 8.0;
277277
for tick in y_ticks {
278278
let text2image = Text2Image::from_text(&tick.to_string(), font_size, None);
279279
text2image.draw_on_canvas(
280280
canvas,
281281
(x - text2image.longest_line(), y - text2image.height() / 2.0),
282282
);
283-
y += y_grid_sep;
283+
y -= y_grid_sep;
284284
}
285285

286286
// 绘制标题

meme_generator_py/meme_generator.pyi

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class Meme:
100100
def generate(
101101
self,
102102
images: list[Image],
103-
text: list[str],
103+
texts: list[str],
104104
options: dict[str, Union[bool, str, int, float]],
105105
) -> Union[
106106
bytes,
@@ -117,13 +117,8 @@ class Meme:
117117
self,
118118
) -> Union[
119119
bytes,
120-
ImageDecodeError,
121120
ImageEncodeError,
122121
ImageAssetMissing,
123-
DeserializeError,
124-
ImageNumberMismatch,
125-
TextNumberMismatch,
126-
TextOverLength,
127122
MemeFeedback,
128123
]: ...
129124

0 commit comments

Comments
 (0)