itwanger/poster is one of the open-source repositories TopGit tracks, currently at 67 stars, written primarily in Java. 仿金山词霸每日一句的分享海报(可添加网络图片、中英文对照句子、个人二维码)
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
public static String makeEnLineFeed(String en, FontDesignMetrics metrics, int max_width) {
// 每个单词后追加空格
char space = ' ';
int spaceWidth = metrics.charWidth(space);
// 按照空格对英文文本进行拆分
String[] words = en.split(String.valueOf(space));
// 利用 StringBuilder 对字符串进行修改
StringBuilder sb = new StringBuilder();
// 每行文本的宽度
int len = 0;
for (int i = 0; i < words.length; i++) {
String word = words[i];
int wordWidth = metrics.stringWidth(word);
// 叠加当前单词的宽度
len += wordWidth;
// 超出最大宽度,进行换行
if (len > max_width) {
sb.append("\n");
sb.append(word);
sb.append(space);
// 下一行的起始宽度
len = wordWidth + spaceWidth;
} else {
sb.append(word);
sb.append(space);
// 多了一个空格
len += spaceWidth;
}
}
return sb.toString();
}
假如文本是“Fear can hold you prisoner. Hope can set you free. It takes a strong man to save himself, and a great man to save another.”我们来通过 makeEnLineFeed() 方法试验一下。
Font font = new Font("微软雅黑", Font.PLAIN, 28);
FontDesignMetrics metrics = FontDesignMetrics.getMetrics(font);
String en = "Fear can hold you prisoner. Hope can set you free. It takes a strong man to save himself, and a great man to save another.";
String[] rows = makeEnLineFeed(en, metrics, 600).split("\n");
for (int i = 0; i < rows.length; i++) {
System.out.println(rows[i]);
}
其结果如下所示。
Fear can hold you prisoner. Hope can set
you free. It takes a strong man to save
himself, and a great man to save another.
TopGit's last sync did not record any GitHub topics for itwanger/poster. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on itwanger/poster?
The most recent commit recorded on itwanger/poster was 7.5 years ago, based on the GitHub push timestamp. The repository has 30 forks — one of the better signals of community interest.
How many stars does itwanger/poster have?
itwanger/poster has 67 GitHub stars — refresh the page for the live number, or check github.com/itwanger/poster. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is itwanger/poster written in?
itwanger/poster is written primarily in Java. GitHub's language field is based on the largest share of bytes in the default branch.
Where do I read more about itwanger/poster?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/itwanger/poster is the definitive source.
Read full README in the tab above.
Curious whether poster is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about poster.