| 25 | } |
| 26 | |
| 27 | int main(int argc, char ** argv) |
| 28 | { |
| 29 | if (argc < 2) |
| 30 | { |
| 31 | std::cout << "Debugging tool to experiment with text segmentation\n"; |
| 32 | std::cout << "Usage: " << argv[0] << " [text file with utf8 strings or any arbitrary text string]\n"; |
| 33 | return -1; |
| 34 | } |
| 35 | |
| 36 | dp::GlyphManager::Params params; |
| 37 | params.m_uniBlocks = "unicode_blocks.txt"; |
| 38 | params.m_whitelist = "fonts_whitelist.txt"; |
| 39 | params.m_blacklist = "fonts_blacklist.txt"; |
| 40 | GetPlatform().GetFontNames(params.m_fonts); |
| 41 | |
| 42 | dp::GlyphManager glyphManager(params); |
| 43 | |
| 44 | if (Platform::IsFileExistsByFullPath(argv[1])) |
| 45 | { |
| 46 | std::ifstream file(argv[1]); |
| 47 | std::string line; |
| 48 | while (file.good()) |
| 49 | { |
| 50 | std::getline(file, line); |
| 51 | ItemizeLine(line, glyphManager); |
| 52 | } |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | // Get all args as one string. |
| 57 | std::vector<std::string> const args(argv + 1, argv + argc); |
| 58 | auto line = std::accumulate(args.begin(), args.end(), std::string{}); |
| 59 | ItemizeLine(line, glyphManager); |
| 60 | } |
| 61 | return 0; |
| 62 | } |
nothing calls this directly
no test coverage detected